Merge pull request #10014 from bcoca/inventory_script_errorhandle
ansible now captures returncode errors on inventory scripts
This commit is contained in:
commit
23783a5228
2 changed files with 8 additions and 0 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue