From 83dec70ad835a818590d360fb742596e0b8f5472 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 9 Oct 2017 17:17:51 -0400 Subject: [PATCH] validate that existing dest is valid directory --- lib/ansible/cli/pull.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/cli/pull.py b/lib/ansible/cli/pull.py index e29ac3174f..08bfa4ab75 100644 --- a/lib/ansible/cli/pull.py +++ b/lib/ansible/cli/pull.py @@ -136,6 +136,9 @@ class PullCLI(CLI): self.options.dest = os.path.join('~/.ansible/pull', hostname) self.options.dest = os.path.expandvars(os.path.expanduser(self.options.dest)) + if os.path.exists(self.options.dest) and not os.path.isdir(self.options.dest): + raise AnsibleOptionsError("%s is not a valid or accessible directory." % self.options.dest) + if self.options.sleep: try: secs = random.randint(0, int(self.options.sleep))