Skip to content

Commit

Permalink
Merge pull request #71 from fosterseth/insights_service_account
Browse files Browse the repository at this point in the history
Add client_id and client_secret fields to Insights credential
  • Loading branch information
chrismeyersfsu authored Jan 9, 2025
2 parents 01d6666 + cc18032 commit c8cff62
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions src/awx_plugins/credentials/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,22 +586,59 @@
inputs={
'fields': [
{
'id': 'username', 'label': gettext_noop('Username'), 'type': 'string',
'id': 'username',
'label': gettext_noop('Username'),
'type': 'string',
'help_text': gettext_noop(
'Required for basic authentication. '
'May be blank if using client_id and client_secret',
),
},
{
'id': 'password', 'label': gettext_noop('Password'), 'type': 'string', 'secret': True,
'id': 'password',
'label': gettext_noop('Password'),
'type': 'string',
'secret': True,
'help_text': gettext_noop(
'Required for basic authentication. '
'May be blank if using client_id and client_secret',
),
},
{
'id': 'client_id',
'label': gettext_noop('Client ID'),
'type': 'string',
'help_text': gettext_noop(
'Required for service account authentication. '
'May be blank if using username and password',
),
},
{
'id': 'client_secret',
'label': gettext_noop('Client Secret'),
'type': 'string',
'secret': True,
'help_text': gettext_noop(
'Required for service account authentication. '
'May be blank if using username and password',
),
},
],
'required': ['username', 'password'],
'required': [],
},
injectors={
'extra_vars': {
'scm_username': '{{username}}',
'scm_password': '{{password}}',
'client_id': '{{client_id}}',
'client_secret': '{{client_secret}}',
'authentication': '{% if client_id %}service_account{% else %}basic{% endif %}',
},
'env': {
'INSIGHTS_USER': '{{username}}',
'INSIGHTS_PASSWORD': '{{password}}',
'INSIGHTS_CLIENT_ID': '{{client_id}}',
'INSIGHTS_CLIENT_SECRET': '{{client_secret}}',
},
},
)
Expand Down

0 comments on commit c8cff62

Please sign in to comment.