Commit 9e5a1670 by Rene Moser

cloudstack: add check for empty inventory

parent bfa71054
......@@ -129,6 +129,8 @@ class CloudStackInventory(object):
def get_host(self, name, project_id=''):
hosts = self.cs.listVirtualMachines(projectid=project_id)
data = {}
if not hosts:
return data
for host in hosts['virtualmachine']:
host_name = host['displayname']
if name == host_name:
......@@ -182,6 +184,8 @@ class CloudStackInventory(object):
}
hosts = self.cs.listVirtualMachines(projectid=project_id)
if not hosts:
return data
for host in hosts['virtualmachine']:
host_name = host['displayname']
data['all']['hosts'].append(host_name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment