mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Added -f/--force option to ansible-pull
This commit is contained in:
@@ -103,6 +103,10 @@ def main(args):
|
||||
help='purge checkout after playbook run')
|
||||
parser.add_option('-o', '--only-if-changed', dest='ifchanged', default=False, action='store_true',
|
||||
help='only run the playbook if the repository has been updated')
|
||||
parser.add_option('-f', '--force', dest='force', default=False,
|
||||
action='store_true',
|
||||
help='run the playbook even if the repository could '
|
||||
'not be updated')
|
||||
parser.add_option('-d', '--directory', dest='dest', default=None,
|
||||
help='directory to checkout repository to')
|
||||
parser.add_option('-U', '--url', dest='url', default=None,
|
||||
@@ -146,7 +150,11 @@ def main(args):
|
||||
)
|
||||
rc, out = _run(cmd)
|
||||
if rc != 0:
|
||||
return rc
|
||||
if options.force:
|
||||
print("Unable to update repository. Continuing with (forced) "
|
||||
"run of playbook.")
|
||||
else:
|
||||
return rc
|
||||
elif options.ifchanged and '"changed": true' not in out:
|
||||
print "Repository has not changed, quitting."
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user