cloudstack: cs_account: create account for states locked/disabled/enabled if not present
This commit is contained in:
parent
497bca48d1
commit
f84b40e542
1 changed files with 2 additions and 2 deletions
|
@ -221,7 +221,7 @@ class AnsibleCloudStackAccount(AnsibleCloudStack):
|
||||||
def enable_account(self):
|
def enable_account(self):
|
||||||
account = self.get_account()
|
account = self.get_account()
|
||||||
if not account:
|
if not account:
|
||||||
self.module.fail_json(msg="Failed: account not present")
|
account = self.present_account()
|
||||||
|
|
||||||
if account['state'].lower() != 'enabled':
|
if account['state'].lower() != 'enabled':
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
|
@ -248,7 +248,7 @@ class AnsibleCloudStackAccount(AnsibleCloudStack):
|
||||||
def lock_or_disable_account(self, lock=False):
|
def lock_or_disable_account(self, lock=False):
|
||||||
account = self.get_account()
|
account = self.get_account()
|
||||||
if not account:
|
if not account:
|
||||||
self.module.fail_json(msg="Failed: account not present")
|
account = self.present_account()
|
||||||
|
|
||||||
# we need to enable the account to lock it.
|
# we need to enable the account to lock it.
|
||||||
if lock and account['state'].lower() == 'disabled':
|
if lock and account['state'].lower() == 'disabled':
|
||||||
|
|
Loading…
Reference in a new issue