From f01289642c4a998fed5bb2451faa6ccac65e9d6f Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 12 Jan 2015 13:53:54 -0500 Subject: [PATCH] Fix an issue where azure inventory plugin would throw an error if there were no instances available --- awx/plugins/inventory/windows_azure.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/plugins/inventory/windows_azure.py b/awx/plugins/inventory/windows_azure.py index 1ee709fa4b..5f861660f1 100755 --- a/awx/plugins/inventory/windows_azure.py +++ b/awx/plugins/inventory/windows_azure.py @@ -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.