mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Merge pull request #7031 from chrismeyersfsu/fix-6342
disallow new survey spec with password default $encrypted$
This commit is contained in:
@@ -2907,10 +2907,14 @@ class JobTemplateSurveySpec(GenericAPIView):
|
|||||||
|
|
||||||
if survey_item["type"] == "password":
|
if survey_item["type"] == "password":
|
||||||
if survey_item.get("default") and survey_item["default"].startswith('$encrypted$'):
|
if survey_item.get("default") and survey_item["default"].startswith('$encrypted$'):
|
||||||
old_spec = obj.survey_spec
|
if not obj.survey_spec:
|
||||||
for old_item in old_spec['spec']:
|
return Response(dict(error=_("$encrypted$ is reserved keyword and may not be used as a default for password {}.".format(str(idx)))),
|
||||||
if old_item['variable'] == survey_item['variable']:
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
survey_item['default'] = old_item['default']
|
else:
|
||||||
|
old_spec = obj.survey_spec
|
||||||
|
for old_item in old_spec['spec']:
|
||||||
|
if old_item['variable'] == survey_item['variable']:
|
||||||
|
survey_item['default'] = old_item['default']
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
||||||
obj.survey_spec = new_spec
|
obj.survey_spec = new_spec
|
||||||
|
|||||||
Reference in New Issue
Block a user