mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Merge pull request #5661 from beeankha/extra_vars_warn_louder_at_launch
Warn Louder When ask_extra_vars Should be Set to True But is Not Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
93a4e5ef05
@ -21,6 +21,7 @@ The following notes are changes that may require changes to playbooks.
|
||||
- When a project is created, it will wait for the update/sync to finish by default; this can be turned off with the `wait` parameter, if desired.
|
||||
- Creating a "scan" type job template is no longer supported.
|
||||
- `extra_vars` in the `tower_job_launch` module worked with a list previously, but is now configured to work solely in a `dict` format.
|
||||
- When the `extra_vars` parameter is used with the `tower_job_launch` module, the Job Template launch will fail unless `add_extra_vars` or `survey_enabled` is explicitly set to `True` on the Job Template.
|
||||
|
||||
## Running
|
||||
|
||||
|
||||
@ -122,11 +122,20 @@ def update_fields(module, p):
|
||||
params = p.copy()
|
||||
|
||||
params_update = {}
|
||||
job_template = params.get('job_template')
|
||||
extra_vars = params.get('extra_vars')
|
||||
try:
|
||||
ask_extra_vars = tower_cli.get_resource('job_template').get(name=job_template)['ask_variables_on_launch']
|
||||
survey_enabled = tower_cli.get_resource('job_template').get(name=job_template)['survey_enabled']
|
||||
except (exc.ConnectionError, exc.BadRequest, exc.AuthError) as excinfo:
|
||||
module.fail_json(msg='Failed to get ask_extra_vars parameter, job template not found: {0}'.format(excinfo), changed=False)
|
||||
|
||||
if extra_vars:
|
||||
if extra_vars and (ask_extra_vars or survey_enabled):
|
||||
params_update['extra_vars'] = [json.dumps(extra_vars)]
|
||||
|
||||
elif extra_vars:
|
||||
module.fail_json(msg="extra_vars is set on launch but the Job Template does not have ask_extra_vars or survey_enabled set to True.")
|
||||
|
||||
params.update(params_update)
|
||||
return params
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user