mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 06:56:00 -03:30
add logic to changed status
This commit is contained in:
@@ -34,6 +34,7 @@ options:
|
|||||||
wait:
|
wait:
|
||||||
description:
|
description:
|
||||||
- Wait for the project to update.
|
- Wait for the project to update.
|
||||||
|
- If scm revision has not changed module will return not changed.
|
||||||
default: True
|
default: True
|
||||||
type: bool
|
type: bool
|
||||||
interval:
|
interval:
|
||||||
@@ -109,6 +110,9 @@ def main():
|
|||||||
if project is None:
|
if project is None:
|
||||||
module.fail_json(msg="Unable to find project")
|
module.fail_json(msg="Unable to find project")
|
||||||
|
|
||||||
|
if wait:
|
||||||
|
scm_revision_original = project['scm_revision']
|
||||||
|
|
||||||
# Update the project
|
# Update the project
|
||||||
result = module.post_endpoint(project['related']['update'])
|
result = module.post_endpoint(project['related']['update'])
|
||||||
|
|
||||||
@@ -126,7 +130,10 @@ def main():
|
|||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
# Invoke wait function
|
# 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)
|
module.exit_json(**module.json_output)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user