Skip to content

Commit

Permalink
BugFix code breaks, if include_vars dir is file instead of directory (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
shuklaabhi authored and BondAnthony committed Oct 4, 2017
1 parent c15d95a commit 8aaddef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ansible/plugins/action/include_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,18 @@ def run(self, tmp=None, task_vars=None):
if self.source_dir:
self._set_dir_defaults()
self._set_root_dir()
if path.exists(self.source_dir):
if not path.exists(self.source_dir):
failed = True
err_msg = ('{0} directory does not exist'.format(self.source_dir))
elif not path.isdir(self.source_dir):
failed = True
err_msg = ('{0} is not a directory'.format(self.source_dir))
else:
for root_dir, filenames in self._traverse_dir_depth():
failed, err_msg, updated_results = (self._load_files_in_dir(root_dir, filenames))
if failed:
break
results.update(updated_results)
else:
failed = True
err_msg = ('{0} directory does not exist'.format(self.source_dir))
else:
try:
self.source_file = self._find_needle('vars', self.source_file)
Expand Down

0 comments on commit 8aaddef

Please sign in to comment.