1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Merge pull request #5115 from AlanCoding/string_explosion

Fix bug: WFJT-type node YAML vars broke task manager

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-10-28 15:15:06 +00:00 committed by GitHub
commit a6fd3d0c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -900,6 +900,9 @@ class LaunchTimeConfigBase(BaseModel):
data[prompt_name] = self.display_extra_vars()
else:
data[prompt_name] = self.extra_vars
# Depending on model, field type may save and return as string
if isinstance(data[prompt_name], str):
data[prompt_name] = parse_yaml_or_json(data[prompt_name])
if self.survey_passwords and not display:
data['survey_passwords'] = self.survey_passwords
else:

View File

@ -234,6 +234,14 @@ class TestWorkflowJobNodeJobKWARGS:
job_node_no_prompts.unified_job_template = project_unit
assert job_node_no_prompts.get_job_kwargs() == self.kwargs_base
def test_extra_vars_node_prompts(self, wfjt_node_no_prompts):
wfjt_node_no_prompts.extra_vars = {'foo': 'bar'}
assert wfjt_node_no_prompts.prompts_dict() == {'extra_vars': {'foo': 'bar'}}
def test_string_extra_vars_node_prompts(self, wfjt_node_no_prompts):
wfjt_node_no_prompts.extra_vars = '{"foo": "bar"}'
assert wfjt_node_no_prompts.prompts_dict() == {'extra_vars': {'foo': 'bar'}}
def test_get_ask_mapping_integrity():
assert list(WorkflowJobTemplate.get_ask_mapping().keys()) == ['extra_vars', 'inventory', 'limit', 'scm_branch']