diff options
author | Milamber <milamber@apache.org> | 2015-01-03 18:57:55 +0000 |
---|---|---|
committer | Rene Moser <mail@renemoser.net> | 2015-04-28 09:20:54 +0200 |
commit | bfa71054f55865297a03ec9d66ce89e57b2824d8 (patch) | |
tree | 34cd529686024fe4ee3942c9024fe2ca8a5b6bcd | |
parent | 92a25b340bbd2e1db0c282576bfd26450f92e761 (diff) | |
download | ansible-bfa71054f55865297a03ec9d66ce89e57b2824d8.tar.gz |
Fix an issue when the cloudstack installation don't have any instance group
-rwxr-xr-x | plugins/inventory/cloudstack.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/inventory/cloudstack.py b/plugins/inventory/cloudstack.py index fdd166ec49..4969b613fe 100755 --- a/plugins/inventory/cloudstack.py +++ b/plugins/inventory/cloudstack.py @@ -173,12 +173,13 @@ class CloudStackInventory(object): } groups = self.cs.listInstanceGroups(projectid=project_id) - for group in groups['instancegroup']: - group_name = group['name'] - if group_name and not group_name in data: - data[group_name] = { - 'hosts': [] - } + if groups: + for group in groups['instancegroup']: + group_name = group['name'] + if group_name and not group_name in data: + data[group_name] = { + 'hosts': [] + } hosts = self.cs.listVirtualMachines(projectid=project_id) for host in hosts['virtualmachine']: |