1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

now captures returncode errors on inventory scripts

This commit is contained in:
Brian Coca 2015-01-15 11:52:22 -05:00
parent 02bc014bcd
commit 6b3d0f4788
2 changed files with 8 additions and 0 deletions

View file

@ -43,6 +43,10 @@ class InventoryScript(object):
except OSError, e: except OSError, e:
raise errors.AnsibleError("problem running %s (%s)" % (' '.join(cmd), e)) raise errors.AnsibleError("problem running %s (%s)" % (' '.join(cmd), e))
(stdout, stderr) = sp.communicate() (stdout, stderr) = sp.communicate()
if sp.returncode != 0:
raise errors.AnsibleError("Inventory script (%s) had an execution error: %s " % (filename,stderr))
self.data = stdout self.data = stdout
# see comment about _meta below # see comment about _meta below
self.host_vars_from_top = None self.host_vars_from_top = None

View file

@ -43,6 +43,10 @@ class InventoryScript(object):
except OSError, e: except OSError, e:
raise errors.AnsibleError("problem running %s (%s)" % (' '.join(cmd), e)) raise errors.AnsibleError("problem running %s (%s)" % (' '.join(cmd), e))
(stdout, stderr) = sp.communicate() (stdout, stderr) = sp.communicate()
if sp.returncode != 0:
raise errors.AnsibleError("Inventory script (%s) had an execution error: %s " % (filename,stderr))
self.data = stdout self.data = stdout
# see comment about _meta below # see comment about _meta below
self.host_vars_from_top = None self.host_vars_from_top = None