Skip to content

Commit c8cff62

Browse files
Merge pull request #71 from fosterseth/insights_service_account
Add client_id and client_secret fields to Insights credential
2 parents 01d6666 + cc18032 commit c8cff62

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

src/awx_plugins/credentials/plugins.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,22 +586,59 @@
586586
inputs={
587587
'fields': [
588588
{
589-
'id': 'username', 'label': gettext_noop('Username'), 'type': 'string',
589+
'id': 'username',
590+
'label': gettext_noop('Username'),
591+
'type': 'string',
592+
'help_text': gettext_noop(
593+
'Required for basic authentication. '
594+
'May be blank if using client_id and client_secret',
595+
),
590596
},
591597
{
592-
'id': 'password', 'label': gettext_noop('Password'), 'type': 'string', 'secret': True,
598+
'id': 'password',
599+
'label': gettext_noop('Password'),
600+
'type': 'string',
601+
'secret': True,
602+
'help_text': gettext_noop(
603+
'Required for basic authentication. '
604+
'May be blank if using client_id and client_secret',
605+
),
606+
},
607+
{
608+
'id': 'client_id',
609+
'label': gettext_noop('Client ID'),
610+
'type': 'string',
611+
'help_text': gettext_noop(
612+
'Required for service account authentication. '
613+
'May be blank if using username and password',
614+
),
615+
},
616+
{
617+
'id': 'client_secret',
618+
'label': gettext_noop('Client Secret'),
619+
'type': 'string',
620+
'secret': True,
621+
'help_text': gettext_noop(
622+
'Required for service account authentication. '
623+
'May be blank if using username and password',
624+
),
593625
},
594626
],
595-
'required': ['username', 'password'],
627+
'required': [],
596628
},
597629
injectors={
598630
'extra_vars': {
599631
'scm_username': '{{username}}',
600632
'scm_password': '{{password}}',
633+
'client_id': '{{client_id}}',
634+
'client_secret': '{{client_secret}}',
635+
'authentication': '{% if client_id %}service_account{% else %}basic{% endif %}',
601636
},
602637
'env': {
603638
'INSIGHTS_USER': '{{username}}',
604639
'INSIGHTS_PASSWORD': '{{password}}',
640+
'INSIGHTS_CLIENT_ID': '{{client_id}}',
641+
'INSIGHTS_CLIENT_SECRET': '{{client_secret}}',
605642
},
606643
},
607644
)

0 commit comments

Comments
 (0)