mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: cs_account re-factor error handling state=present
This commit is contained in:
parent
f84b40e542
commit
cd39bdd11d
1 changed files with 10 additions and 15 deletions
|
@ -277,21 +277,16 @@ class AnsibleCloudStackAccount(AnsibleCloudStack):
|
||||||
def present_account(self):
|
def present_account(self):
|
||||||
missing_params = []
|
missing_params = []
|
||||||
|
|
||||||
if not self.module.params.get('email'):
|
missing_params = []
|
||||||
missing_params.append('email')
|
for required_params in [
|
||||||
|
'email',
|
||||||
if not self.module.params.get('username'):
|
'username',
|
||||||
missing_params.append('username')
|
'password',
|
||||||
|
'first_name',
|
||||||
if not self.module.params.get('password'):
|
'last_name',
|
||||||
missing_params.append('password')
|
]:
|
||||||
|
if not self.module.params.get(required_params):
|
||||||
if not self.module.params.get('first_name'):
|
missing_params.append(required_params)
|
||||||
missing_params.append('first_name')
|
|
||||||
|
|
||||||
if not self.module.params.get('last_name'):
|
|
||||||
missing_params.append('last_name')
|
|
||||||
|
|
||||||
if missing_params:
|
if missing_params:
|
||||||
self.module.fail_json(msg="missing required arguments: %s" % ','.join(missing_params))
|
self.module.fail_json(msg="missing required arguments: %s" % ','.join(missing_params))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue