From d3e48a51f5c0c20a55a226ebe4dc8976aadc9324 Mon Sep 17 00:00:00 2001 From: giovannisciortino <30353557+giovannisciortino@users.noreply.github.com> Date: Mon, 14 Aug 2017 17:20:05 +0200 Subject: [PATCH] Add check mode support to ansible-pull (#28021) Fixes #27989 --- lib/ansible/cli/pull.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/cli/pull.py b/lib/ansible/cli/pull.py index 5ebb51881f4..94103edaa02 100644 --- a/lib/ansible/cli/pull.py +++ b/lib/ansible/cli/pull.py @@ -107,6 +107,8 @@ class PullCLI(CLI): help='modified files in the working repository will be discarded') 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') + 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 self.parser.set_defaults(inventory=None) @@ -243,6 +245,8 @@ class PullCLI(CLI): cmd += ' -l "%s"' % self.options.subset else: cmd += ' -l "%s"' % limit_opts + if self.options.check: + cmd += ' -C' os.chdir(self.options.dest)