add logic to changed status

This commit is contained in:
sean-m-ssullivan 2021-03-28 22:35:38 -05:00
parent 0b6acdbcc9
commit dbcdbe0770

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,10 @@ 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)