Skip to content

Commit

Permalink
Change awx.awx.application to output the OAuth2 client secret
Browse files Browse the repository at this point in the history
if one was generated.
  • Loading branch information
jbradberry committed Mar 28, 2024
1 parent d9b8173 commit 1559c21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions awx_collection/plugins/modules/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
- assert:
that:
- "result is changed"
- "'client_secret' in result"

- name: Rename an inventory
application:
Expand Down

0 comments on commit 1559c21

Please sign in to comment.