diff --git a/awx/api/views.py b/awx/api/views.py index 63321ac537..57ede93ded 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -2421,7 +2421,7 @@ class JobTemplateSurveySpec(GenericAPIView): raise LicenseForbids(_('Your license does not allow ' 'adding surveys.')) survey_spec = obj.survey_spec - for pos, field in enumerate(survey_spec['spec']): + for pos, field in enumerate(survey_spec.get('spec', [])): if field.get('type') == 'password': if 'default' in field and field['default']: field['default'] = '$encrypted$'