Do not set the default if the field was not passed in to kwargs_extra_vars

This commit is contained in:
Wayne Witzel III
2017-03-24 15:43:52 -04:00
parent 5907b3dcad
commit c99d4659da
2 changed files with 4 additions and 2 deletions

View File

@@ -130,12 +130,14 @@ class SurveyJobTemplateMixin(models.Model):
for survey_element in self.survey_spec.get("spec", []):
default = survey_element.get('default')
variable_key = survey_element.get('variable')
if survey_element.get('type') == 'password':
if variable_key in kwargs_extra_vars and default:
kw_value = kwargs_extra_vars[variable_key]
if kw_value.startswith('$encrypted$') and kw_value != default:
kwargs_extra_vars[variable_key] = default
if default is not None:
if default is not None and variable_key in extra_vars:
extra_vars[variable_key] = default
# Overwrite job template extra vars with explicit job extra vars