mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 01:28:09 -03:30
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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user