Changed the become_method field into one that takes arbitrary input

related #2630

Signed-off-by: Jeff Bradberry <jeff.bradberry@gmail.com>
This commit is contained in:
Jeff Bradberry
2019-01-28 14:49:59 -05:00
parent 155c214df0
commit 0ecd6542bf
5 changed files with 10 additions and 22 deletions

View File

@@ -5,7 +5,6 @@
import copy
import json
import logging
import operator
import re
import urllib.parse
from collections import OrderedDict
@@ -45,7 +44,6 @@ from awx.main.constants import (
ANSI_SGR_PATTERN,
ACTIVE_STATES,
CENSOR_VALUE,
CHOICES_PRIVILEGE_ESCALATION_METHODS,
)
from awx.main.models import * # noqa
from awx.main.models.base import NEW_JOB_TYPE_CHOICES
@@ -2499,8 +2497,7 @@ class CredentialTypeSerializer(BaseSerializer):
if 'help_text' in field:
field['help_text'] = _(field['help_text'])
if field['type'] == 'become_method':
field.pop('type')
field['choices'] = list(map(operator.itemgetter(0), CHOICES_PRIVILEGE_ESCALATION_METHODS))
field['type'] = 'string'
return value
def filter_field_metadata(self, fields, method):