From 7e1ff91a5aa4f771aa79b95b442a45d42d0900a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Wed, 21 Feb 2018 11:04:52 +0100 Subject: [PATCH] cs_user: fix return user_api_secret for ACS v4.10 and later (#36447) (#36489) (cherry picked from commit 6402a3e50410b911a2f1742d6bd623dd032452a9) --- lib/ansible/modules/cloud/cloudstack/cs_user.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/modules/cloud/cloudstack/cs_user.py b/lib/ansible/modules/cloud/cloudstack/cs_user.py index 3140d43bcdb..33c15a0b8ab 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_user.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_user.py @@ -400,6 +400,13 @@ class AnsibleCloudStackUser(AnsibleCloudStack): if value == user['accounttype']: self.result['account_type'] = key break + + # secretkey has been removed since CloudStack 4.10 from listUsers API + if self.module.params.get('keys_registered') and 'apikey' in user and 'secretkey' not in user: + user_keys = self.query_api('getUserKeys', id=user['id']) + if user_keys: + self.result['user_api_secret'] = user_keys['userkeys'].get('secretkey') + return self.result