Add check mode support to ansible-pull (#28021)

Fixes #27989
pull/28170/head
giovannisciortino 7 years ago committed by Sam Doran
parent fe2e17f7cd
commit d3e48a51f5

@ -107,6 +107,8 @@ class PullCLI(CLI):
help='modified files in the working repository will be discarded') help='modified files in the working repository will be discarded')
self.parser.add_option('--track-subs', dest='tracksubs', default=False, action='store_true', self.parser.add_option('--track-subs', dest='tracksubs', default=False, action='store_true',
help='submodules will track the latest changes. This is equivalent to specifying the --remote flag to git submodule update') help='submodules will track the latest changes. This is equivalent to specifying the --remote flag to git submodule update')
self.parser.add_option("--check", default=False, dest='check', action='store_true',
help="don't make any changes; instead, try to predict some of the changes that may occur")
# for pull we don't want a default # for pull we don't want a default
self.parser.set_defaults(inventory=None) self.parser.set_defaults(inventory=None)
@ -243,6 +245,8 @@ class PullCLI(CLI):
cmd += ' -l "%s"' % self.options.subset cmd += ' -l "%s"' % self.options.subset
else: else:
cmd += ' -l "%s"' % limit_opts cmd += ' -l "%s"' % limit_opts
if self.options.check:
cmd += ' -C'
os.chdir(self.options.dest) os.chdir(self.options.dest)

Loading…
Cancel
Save