mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 03:01:06 -03:30
ignore workflow survey passwords when not applicable
This commit is contained in:
@@ -873,8 +873,11 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
|
|||||||
JobLaunchConfig = self._meta.get_field('launch_config').related_model
|
JobLaunchConfig = self._meta.get_field('launch_config').related_model
|
||||||
config = JobLaunchConfig(job=self)
|
config = JobLaunchConfig(job=self)
|
||||||
valid_fields = self.unified_job_template.get_ask_mapping().keys()
|
valid_fields = self.unified_job_template.get_ask_mapping().keys()
|
||||||
|
# Special cases allowed for workflows
|
||||||
if hasattr(self, 'extra_vars'):
|
if hasattr(self, 'extra_vars'):
|
||||||
valid_fields.extend(['survey_passwords', 'extra_vars'])
|
valid_fields.extend(['survey_passwords', 'extra_vars'])
|
||||||
|
else:
|
||||||
|
kwargs.pop('survey_passwords', None)
|
||||||
for field_name, value in kwargs.items():
|
for field_name, value in kwargs.items():
|
||||||
if field_name not in valid_fields:
|
if field_name not in valid_fields:
|
||||||
raise Exception('Unrecognized launch config field {}.'.format(field_name))
|
raise Exception('Unrecognized launch config field {}.'.format(field_name))
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ class TestConfigCreation:
|
|||||||
config = job.launch_config
|
config = job.launch_config
|
||||||
assert set(config.credentials.all()) == set([credential])
|
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
|
@pytest.mark.django_db
|
||||||
class TestConfigReversibility:
|
class TestConfigReversibility:
|
||||||
|
|||||||
Reference in New Issue
Block a user