mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix for an exception when for whatever reason the inventory script fails
This avoids a traceback that gave no clue as to what was happening. This is in line with the change from #1535
This commit is contained in:
parent
75d3b77454
commit
c9e62d7061
1 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue