Commit 0ed2595b by Michael DeHaan

Merge pull request #1548 from dagwieers/inventory-host-exception

Fix for an exception when for whatever reason the inventory script fails
parents 43410c46 c9e62d70
......@@ -279,12 +279,12 @@ class Inventory(object):
vars.update(updated)
if self._is_script:
cmd = subprocess.Popen(
[self.host_list,"--host",hostname],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
(out, err) = cmd.communicate()
cmd = [self.host_list,"--host",hostname]
try:
sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except OSError, e:
raise errors.AnsibleError("problem running %s (%s)" % (' '.join(cmd), e))
(out, err) = sp.communicate()
results = utils.parse_json(out)
# FIXME: this is a bit redundant with host.py and should share code
......
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