diff options
author | René Moser <mail@renemoser.net> | 2016-12-14 11:37:26 +0100 |
---|---|---|
committer | Rene Moser <mail@renemoser.net> | 2016-12-14 16:37:09 +0100 |
commit | e715221a668e3fb91c479a46b3576dcc82260098 (patch) | |
tree | dcca12a1f0164940ea4d337498c49cd5730e4b80 | |
parent | fe33c937c42a7dd310b2454ec592ea764e6e50b5 (diff) | |
download | ansible-e715221a668e3fb91c479a46b3576dcc82260098.tar.gz |
cloudstack: utils: fail friendlier if no zones available (#19332)
(cherry picked from commit 18b7852940a3525bc7d147f68420b360b29cd0d0)
-rw-r--r-- | lib/ansible/module_utils/cloudstack.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/cloudstack.py b/lib/ansible/module_utils/cloudstack.py index b4b3b1b53f..fa05426db8 100644 --- a/lib/ansible/module_utils/cloudstack.py +++ b/lib/ansible/module_utils/cloudstack.py @@ -344,6 +344,9 @@ class AnsibleCloudStack(object): zone = self.module.params.get('zone') 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 if not zone: self.zone = zones['zone'][0] |