cloudstack: utils: fail friendlier if no zones available (#19332)

(cherry picked from commit 18b7852940)
This commit is contained in:
René Moser 2016-12-14 11:37:26 +01:00 committed by Rene Moser
parent fe33c937c4
commit e715221a66

View file

@ -344,6 +344,9 @@ class AnsibleCloudStack(object):
zone = self.module.params.get('zone') zone = self.module.params.get('zone')
zones = self.cs.listZones() zones = self.cs.listZones()
if not zones:
self.module.fail_json(msg="No zones available. Please create a zone first")
# use the first zone if no zone param given # use the first zone if no zone param given
if not zone: if not zone:
self.zone = zones['zone'][0] self.zone = zones['zone'][0]