Merge pull request #9729 from sean-m-sullivan/project_update_changed

Update changed logic on project update

SUMMARY
Related to #8349
Found the inventory source does not have a way to track it, so did not do that part.
However scm revision is tracked for project update, as we already retrieve this data when looking for the existing item and waiting, put in logic to compare the two values when wait is true.
Also double checked the integration tests, and believe this should not change them, as its looking for result is success not changed in all but the first update.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME

awx_collection

AWX VERSION
18.0.0

Reviewed-by: Bianca Henderson <beeankha@gmail.com>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-03-30 15:07:45 +00:00 committed by GitHub
commit 16c18886e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -72,6 +72,8 @@ Notable releases of the `awx.awx` collection:
The following notes are changes that may require changes to playbooks:
- When a project is created, it will wait for the update/sync to finish by default; this can be turned off with the `wait` parameter, if desired.
- When using the wait parameter with project update, if the project did not undergo a revision update, the result will be
'not changed'
- Creating a "scan" type job template is no longer supported.
- Specifying a custom certificate via the `TOWER_CERTIFICATE` environment variable no longer works.
- Type changes of variable fields:

View File

@ -34,6 +34,7 @@ options:
wait:
description:
- Wait for the project to update.
- If scm revision has not changed module will return not changed.
default: True
type: bool
interval:
@ -109,6 +110,9 @@ def main():
if project is None:
module.fail_json(msg="Unable to find project")
if wait:
scm_revision_original = project['scm_revision']
# Update the project
result = module.post_endpoint(project['related']['update'])
@ -126,7 +130,12 @@ def main():
start = time.time()
# Invoke wait function
module.wait_on_url(url=result['json']['url'], object_name=module.get_item_name(project), object_type='Project Update', timeout=timeout, interval=interval)
result = module.wait_on_url(
url=result['json']['url'], object_name=module.get_item_name(project), object_type='Project Update', timeout=timeout, interval=interval
)
scm_revision_new = result['json']['scm_revision']
if scm_revision_new == scm_revision_original:
module.json_output['changed'] = False
module.exit_json(**module.json_output)

View File

@ -53,6 +53,7 @@
- assert:
that:
- result is successful
- result is not changed
- name: Delete the test project 1
tower_project: