mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 15:06:02 -03:30
add logic for survey
This commit is contained in:
@@ -152,15 +152,17 @@ def main():
|
||||
'inventory': 'ask_inventory_on_launch',
|
||||
'limit': 'ask_limit_on_launch',
|
||||
'scm_branch': 'ask_scm_branch_on_launch',
|
||||
'extra_vars': 'ask_variables_on_launch',
|
||||
}
|
||||
|
||||
param_errors = []
|
||||
for variable_name in check_vars_to_prompts:
|
||||
if variable_name in post_data and not workflow_job_template[check_vars_to_prompts[variable_name]]:
|
||||
param_errors.append("The field {0} was specified but the workflow job template does not allow for it to be overridden".format(variable_name))
|
||||
# Check if Either ask_variables_on_launch, or survey_enabled is enabled for use of extra vars.
|
||||
if module.params.get('extra_vars') and not (workflow_job_template['ask_variables_on_launch'] or workflow_job_template['survey_enabled']):
|
||||
param_errors.append("The field extra_vars was specified but the workflow job template does not allow for it to be overridden")
|
||||
if len(param_errors) > 0:
|
||||
module.fail_json(msg="Parameters specified which can not be passed into wotkflow job template, see errors for details", errors=param_errors)
|
||||
module.fail_json(msg="Parameters specified which can not be passed into workflow job template, see errors for details", errors=param_errors)
|
||||
|
||||
# Launch the job
|
||||
result = module.post_endpoint(workflow_job_template['related']['launch'], data=post_data)
|
||||
|
||||
Reference in New Issue
Block a user