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

Merge pull request #1666 from AlanCoding/fix_workflow_vars_again

Ignore workflow survey passwords when not applicable
This commit is contained in:
Alan Rominger 2018-03-26 11:17:32 -04:00 committed by GitHub
commit 4c2cff7a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -873,8 +873,11 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
JobLaunchConfig = self._meta.get_field('launch_config').related_model
config = JobLaunchConfig(job=self)
valid_fields = self.unified_job_template.get_ask_mapping().keys()
# Special cases allowed for workflows
if hasattr(self, 'extra_vars'):
valid_fields.extend(['survey_passwords', 'extra_vars'])
else:
kwargs.pop('survey_passwords', None)
for field_name, value in kwargs.items():
if field_name not in valid_fields:
raise Exception('Unrecognized launch config field {}.'.format(field_name))

View File

@ -48,6 +48,12 @@ class TestConfigCreation:
config = job.launch_config
assert set(config.credentials.all()) == set([credential])
def test_survey_passwords_ignored(self, inventory_source):
iu = inventory_source.create_unified_job(
survey_passwords={'foo': '$encrypted$'}
)
assert iu.launch_config.prompts_dict() == {}
@pytest.mark.django_db
class TestConfigReversibility: