summaryrefslogtreecommitdiffstats
path: root/awx_collection
diff options
context:
space:
mode:
authorJeff Bradberry <jeff.bradberry@gmail.com>2024-03-27 20:13:51 +0100
committerJeff Bradberry <jeff.bradberry@gmail.com>2024-03-28 15:17:46 +0100
commit1559c21033b154703f9b675a96e501731208327c (patch)
tree9914ede30108a21ea0c82d08c24b9d8d722f29b3 /awx_collection
parentFix: broken reference to API url (diff)
downloadawx-1559c21033b154703f9b675a96e501731208327c.tar.xz
awx-1559c21033b154703f9b675a96e501731208327c.zip
Change awx.awx.application to output the OAuth2 client secret
if one was generated.
Diffstat (limited to 'awx_collection')
-rw-r--r--awx_collection/plugins/modules/application.py8
-rw-r--r--awx_collection/tests/integration/targets/application/tasks/main.yml1
2 files changed, 7 insertions, 2 deletions
diff --git a/awx_collection/plugins/modules/application.py b/awx_collection/plugins/modules/application.py
index 7a31522a08..1933143af3 100644
--- a/awx_collection/plugins/modules/application.py
+++ b/awx_collection/plugins/modules/application.py
@@ -147,8 +147,12 @@ def main():
if redirect_uris is not None:
application_fields['redirect_uris'] = ' '.join(redirect_uris)
- # If the state was present and we can let the module build or update the existing application, this will return on its own
- module.create_or_update_if_needed(application, application_fields, endpoint='applications', item_type='application')
+ response = module.create_or_update_if_needed(application, application_fields, endpoint='applications', item_type='application', auto_exit=False)
+ if 'client_id' in response:
+ module.json_output['client_id'] = response['client_id']
+ if 'client_secret' in response:
+ module.json_output['client_secret'] = response['client_secret']
+ module.exit_json(**module.json_output)
if __name__ == '__main__':
diff --git a/awx_collection/tests/integration/targets/application/tasks/main.yml b/awx_collection/tests/integration/targets/application/tasks/main.yml
index 864d4d0ac2..e2e82eab82 100644
--- a/awx_collection/tests/integration/targets/application/tasks/main.yml
+++ b/awx_collection/tests/integration/targets/application/tasks/main.yml
@@ -103,6 +103,7 @@
- assert:
that:
- "result is changed"
+ - "'client_secret' in result"
- name: Rename an inventory
application: