awx icon indicating copy to clipboard operation
awx copied to clipboard

[collection] `awx.awx.project` spams `/api/v2/project_updates/<id>/ endpoint` when `wait: True`

Open relrod opened this issue 3 years ago • 0 comments

Please confirm the following

  • [X] I agree to follow this project's code of conduct.
  • [X] I have checked the current issues for duplicates.
  • [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.

Bug Summary

When creating a new project using the API with wait: true (the default), we end up spamming /api/v2/project_updates/<id>/ way more than is ideal, with no delay at all.

Reproducer playbook is below.

Looking into the module code, I see this:

            if module.is_job_done(result['status']):
                time.sleep(1)
                running = False

I'm guessing that really that sleep() should be in an else, i.e. if the job is not done, sleep 1 second and try again, rather than sleeping (for no reason?) when the project is done updating.

AWX version

devel

Select the relevant components

  • [ ] UI
  • [ ] API
  • [ ] Docs
  • [X] Collection
  • [ ] CLI
  • [ ] Other

Installation method

docker development environment

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

No response

Steps to reproduce

- hosts: localhost
  tasks:
    - awx.awx.project:
        controller_username: awx
        controller_password: awx
        controller_host: "https://localhost:8043"
        validate_certs: false
        name: test-project
        scm_branch: testinfra
        scm_url: https://github.com/relrod/ansible-sign-demo/
        scm_type: git

Expected results

Not spamming the heck out of AWX :)

Actual results

image

Additional information

No response

relrod avatar Sep 08 '22 10:09 relrod