mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
better error when host inventory script isnt dict
This commit is contained in:
parent
6e716b177e
commit
af88e34831
1 changed files with 4 additions and 1 deletions
|
@ -149,7 +149,10 @@ class InventoryScript:
|
||||||
def get_host_variables(self, host):
|
def get_host_variables(self, host):
|
||||||
""" Runs <script> --host <hostname> to determine additional host variables """
|
""" Runs <script> --host <hostname> to determine additional host variables """
|
||||||
if self.host_vars_from_top is not None:
|
if self.host_vars_from_top is not None:
|
||||||
|
try:
|
||||||
got = self.host_vars_from_top.get(host.name, {})
|
got = self.host_vars_from_top.get(host.name, {})
|
||||||
|
except AttributeError as e:
|
||||||
|
raise AnsibleError("Improperly formated host information for %s: %s" % (host.name,to_str(e)))
|
||||||
return got
|
return got
|
||||||
|
|
||||||
cmd = [self.filename, "--host", host.name]
|
cmd = [self.filename, "--host", host.name]
|
||||||
|
|
Loading…
Reference in a new issue