mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #106 from mgwilliams/honor-hostfile-returncode
raise error if executable host file execution fails
This commit is contained in:
commit
2f1f0d44b4
1 changed files with 3 additions and 0 deletions
|
@ -160,6 +160,9 @@ class Runner(object):
|
||||||
cmd.extend(['--extra-vars', extra_vars])
|
cmd.extend(['--extra-vars', extra_vars])
|
||||||
cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
|
cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
|
||||||
out, err = cmd.communicate()
|
out, err = cmd.communicate()
|
||||||
|
rc = cmd.returncode
|
||||||
|
if rc:
|
||||||
|
raise errors.AnsibleError("%s: %s" % (host_list, err))
|
||||||
try:
|
try:
|
||||||
groups = utils.json_loads(out)
|
groups = utils.json_loads(out)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Reference in a new issue