diff --git a/awx/main/constants.py b/awx/main/constants.py index 7305a94a34..2ca34a47c5 100644 --- a/awx/main/constants.py +++ b/awx/main/constants.py @@ -14,7 +14,7 @@ __all__ = [ CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'rhv', 'satellite6', 'cloudforms', 'tower') SCHEDULEABLE_PROVIDERS = CLOUD_PROVIDERS + ('custom', 'scm',) PRIVILEGE_ESCALATION_METHODS = [ - ('', _('None')), ('enable', _('Enable')), ('doas', _('Doas')), + ('enable', _('Enable')), ('doas', _('Doas')), ('sudo', _('Sudo')), ('su', _('Su')), ('pbrun', _('Pbrun')), ('pfexec', _('Pfexec')), ('dzdo', _('DZDO')), ('pmrun', _('Pmrun')), ('runas', _('Runas'))] ANSI_SGR_PATTERN = re.compile(r'\x1b\[[0-9;]*m') diff --git a/awx/main/fields.py b/awx/main/fields.py index ec9ada6cf8..d956e3e808 100644 --- a/awx/main/fields.py +++ b/awx/main/fields.py @@ -714,7 +714,7 @@ class CredentialTypeInputField(JSONSchemaField): if field['type'] == 'become_method': if not model_instance.managed_by_tower: raise django_exceptions.ValidationError( - _('{0} is a reserved type name'.format(field['type'])), + _('become_method is a reserved type name'), code='invalid', params={'value': value}, ) diff --git a/awx/main/migrations/_credentialtypes.py b/awx/main/migrations/_credentialtypes.py index 247ca42a36..6d71776d6b 100644 --- a/awx/main/migrations/_credentialtypes.py +++ b/awx/main/migrations/_credentialtypes.py @@ -200,6 +200,6 @@ def add_azure_cloud_environment_field(apps, schema_editor): def remove_become_methods(apps, schema_editor): - become_credtype = CredentialType.objects.get(kind='ssh') + become_credtype = CredentialType.objects.get(kind='ssh').first() become_credtype.inputs = CredentialType.defaults.get('ssh')().inputs become_credtype.save() diff --git a/awx/main/models/credential/__init__.py b/awx/main/models/credential/__init__.py index b372144512..b40b85154d 100644 --- a/awx/main/models/credential/__init__.py +++ b/awx/main/models/credential/__init__.py @@ -165,7 +165,7 @@ class V1Credential(object): max_length=32, blank=True, default='', - choices=PRIVILEGE_ESCALATION_METHODS, + choices=[('', _('None'))] + PRIVILEGE_ESCALATION_METHODS, help_text=_('Privilege escalation method.') ), 'become_username': models.CharField(