Commit 41619278 by Seth Vidal

handle issues when the hostlist is inadvertently set executable

and/or executing it fails. This produces a nicer error message than
a traceback
parent 02abb5a8
...@@ -134,8 +134,12 @@ class Inventory(object): ...@@ -134,8 +134,12 @@ class Inventory(object):
cmd = [self.inventory_file, '--list'] cmd = [self.inventory_file, '--list']
cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) try:
out, err = cmd.communicate() cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
out, err = cmd.communicate()
except Exception, e:
raise errors.AnsibleError("Failure executing %s to produce host list:\n %s" % (self.inventory_file, str(e)))
rc = cmd.returncode rc = cmd.returncode
if rc: if rc:
raise errors.AnsibleError("%s: %s" % self.inventory_file, err) raise errors.AnsibleError("%s: %s" % self.inventory_file, err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment