cloudstack: utils: fail friendlier if no zones available (#19332)
(cherry picked from commit 18b7852940
)
This commit is contained in:
parent
fe33c937c4
commit
e715221a66
1 changed files with 3 additions and 0 deletions
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue