Don't hardcode privilege escalation prompts if they're all of the same format.

Just create them all from supported privilege escalation types.
This commit is contained in:
Bill Nottingham
2017-07-25 12:06:40 -04:00
parent a6f5686ef4
commit 864d803273
3 changed files with 18 additions and 38 deletions

View File

@@ -19,6 +19,7 @@ from django.utils.encoding import force_text
# AWX
from awx.api.versioning import reverse
from awx.main.constants import PRIVILEGE_ESCALATION_METHODS
from awx.main.fields import (ImplicitRoleField, CredentialInputField,
CredentialTypeInputField,
CredentialTypeInjectorField)
@@ -135,15 +136,7 @@ class V1Credential(object):
max_length=32,
blank=True,
default='',
choices=[
('', _('None')),
('sudo', _('Sudo')),
('su', _('Su')),
('pbrun', _('Pbrun')),
('pfexec', _('Pfexec')),
('dzdo', _('DZDO')),
('pmrun', _('Pmrun')),
],
choices=[('', _('None'))] + PRIVILEGE_ESCALATION_METHODS,
help_text=_('Privilege escalation method.')
),
'become_username': models.CharField(