From f84b40e542ec6a31a4816166c29c800ec2b6f148 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Fri, 11 Sep 2015 19:03:35 +0200 Subject: [PATCH] cloudstack: cs_account: create account for states locked/disabled/enabled if not present --- lib/ansible/modules/extras/cloud/cloudstack/cs_account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py index fe2884f721b..b8c2f0f54ef 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py @@ -221,7 +221,7 @@ class AnsibleCloudStackAccount(AnsibleCloudStack): def enable_account(self): account = self.get_account() if not account: - self.module.fail_json(msg="Failed: account not present") + account = self.present_account() if account['state'].lower() != 'enabled': self.result['changed'] = True @@ -248,7 +248,7 @@ class AnsibleCloudStackAccount(AnsibleCloudStack): def lock_or_disable_account(self, lock=False): account = self.get_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. if lock and account['state'].lower() == 'disabled':