mirror of
https://github.com/ansible/awx.git
synced 2026-08-01 18:39:54 -02:30
fix bug saving extra_data and follow prompts rules
display_extra_vars was not taking a copy of the data before acting on it - this causes a bug where the activity stream will modify the existing object on the model. That leads to new data not being accepted. Also moved the processing of extra_data to prior to the accept or ignore kwargs logic so that we pass the right (post-encryption) form of the variables.
This commit is contained in:
@@ -14,7 +14,7 @@ from awx.main.models.rbac import (
|
||||
Role, RoleAncestorEntry, get_roles_on_resource
|
||||
)
|
||||
from awx.main.utils import parse_yaml_or_json
|
||||
from awx.main.utils.encryption import decrypt_value, get_encryption_key
|
||||
from awx.main.utils.encryption import decrypt_value, get_encryption_key, is_encrypted
|
||||
from awx.main.fields import JSONField, AskForField
|
||||
|
||||
|
||||
@@ -266,9 +266,10 @@ class SurveyJobTemplateMixin(models.Model):
|
||||
survey_errors = []
|
||||
for survey_element in self.survey_spec.get("spec", []):
|
||||
key = survey_element.get('variable', None)
|
||||
if extra_passwords and key in extra_passwords and data.get(key, None):
|
||||
value = data.get(key, None)
|
||||
if extra_passwords and key in extra_passwords and is_encrypted(value):
|
||||
element_errors = self._survey_element_validation(survey_element, {
|
||||
key: decrypt_value(get_encryption_key('value', pk=None), data[key])
|
||||
key: decrypt_value(get_encryption_key('value', pk=None), value)
|
||||
})
|
||||
else:
|
||||
element_errors = self._survey_element_validation(survey_element, data)
|
||||
|
||||
Reference in New Issue
Block a user