1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00
Ryan Petrello 2017-11-27 17:25:45 -05:00
parent 5a2ecd25e7
commit 044c047ac6
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -166,15 +166,19 @@ class SurveyJobTemplateMixin(models.Model):
# make a copy of the data to break references (so that we don't # make a copy of the data to break references (so that we don't
# inadvertently expose unencrypted default passwords as we validate) # inadvertently expose unencrypted default passwords as we validate)
data = data.copy() data = data.copy()
if all([ password_value = data.get(survey_element['variable'])
survey_element['type'] == "password", if (
data.get(survey_element['variable']) == '$encrypted$' survey_element['type'] == "password" and
]): isinstance(password_value, basestring) and
# replace encrypted password defaults so we don't validate on password_value.startswith('$encrypted$')
# $encrypted$ ):
if password_value == '$encrypted$':
# replace encrypted password defaults so we don't validate on
# $encrypted$
password_value = survey_element['default']
data[survey_element['variable']] = decrypt_value( data[survey_element['variable']] = decrypt_value(
get_encryption_key('value', pk=None), get_encryption_key('value', pk=None),
survey_element['default'] password_value
) )
if survey_element['variable'] not in data and survey_element['required']: if survey_element['variable'] not in data and survey_element['required']:
errors.append("'%s' value missing" % survey_element['variable']) errors.append("'%s' value missing" % survey_element['variable'])