mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-09-04 20:22:20 -07:00
Merge pull request #220 from skvidal/devel
handle issues when the hostlist is inadvertently set executable
This commit is contained in:
commit
90a8893418
1 changed files with 6 additions and 2 deletions
|
@ -134,8 +134,12 @@ class Inventory(object):
|
||||||
|
|
||||||
cmd = [self.inventory_file, '--list']
|
cmd = [self.inventory_file, '--list']
|
||||||
|
|
||||||
cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
|
try:
|
||||||
out, err = cmd.communicate()
|
cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
|
||||||
|
out, err = cmd.communicate()
|
||||||
|
except Exception, e:
|
||||||
|
raise errors.AnsibleError("Failure executing %s to produce host list:\n %s" % (self.inventory_file, str(e)))
|
||||||
|
|
||||||
rc = cmd.returncode
|
rc = cmd.returncode
|
||||||
if rc:
|
if rc:
|
||||||
raise errors.AnsibleError("%s: %s" % self.inventory_file, err)
|
raise errors.AnsibleError("%s: %s" % self.inventory_file, err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue