Skip to content

Commit

Permalink
validate that existing dest is valid directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoca committed Oct 12, 2017
1 parent 8dd1267 commit 83dec70
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ansible/cli/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def parse(self):
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))
Expand Down

0 comments on commit 83dec70

Please sign in to comment.