Fix an issue where azure inventory plugin would throw an error if there

were no instances available
This commit is contained in:
Matthew Jones 2015-01-12 13:53:54 -05:00
parent 221ebd846b
commit f01289642c

View File

@ -100,9 +100,10 @@ class AzureInventory(object):
# Add the `_meta` information.
_meta = {}
for host in set(reduce(lambda x, y: x + y,
[i for i in data.values()])):
_meta[host] = self.get_host(host, jsonify=False)
if len(data) > 0:
for host in set(reduce(lambda x, y: x + y,
[i for i in data.values()])):
_meta[host] = self.get_host(host, jsonify=False)
data['_meta'] = _meta
# JSONify the data.