Skip to content

Commit

Permalink
add check_mode to collection_repository_sync (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaps authored Aug 13, 2024
1 parent 8f57a67 commit da5c4e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/modules/collection_repository_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,18 @@ def main():
wait = module.params.get("wait")
interval = module.params.get("interval")
timeout = module.params.get("timeout")
check_mode = module.params.get("check_mode")

# Get the ansible_repository
ansible_repository = AHPulpAnsibleRepository(module)
ansible_repository.get_object(name=name)
if not ansible_repository.exists:
module.fail_json(msg="The container registery with name: {name}, was not found.".format(name=name))

ansible_repository.sync(wait, interval, timeout)
if check_mode:
module.exit_json(changed=True, msg="Would have synced collection repository: {name}".format(name=name))
else:
ansible_repository.sync(wait, interval, timeout)

module.exit_json(**module.json_output)

Expand Down

0 comments on commit da5c4e4

Please sign in to comment.