diff --git a/awx/api/views.py b/awx/api/views.py index aa45f2616d..bd00d05009 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -3319,7 +3319,8 @@ class JobTemplateCallback(GenericAPIView): return Response(data, status=status.HTTP_400_BAD_REQUEST) # Everything is fine; actually create the job. - kv = {"limit": limit, "launch_type": 'callback'} + kv = {"limit": limit} + kv.setdefault('_eager_fields', {})['launch_type'] = 'callback' if extra_vars is not None and job_template.ask_variables_on_launch: extra_vars_redacted, removed = extract_ansible_vars(extra_vars) kv['extra_vars'] = extra_vars_redacted diff --git a/awx/main/tests/functional/api/test_job_runtime_params.py b/awx/main/tests/functional/api/test_job_runtime_params.py index 7cfd0a3871..dceb08158b 100644 --- a/awx/main/tests/functional/api/test_job_runtime_params.py +++ b/awx/main/tests/functional/api/test_job_runtime_params.py @@ -560,10 +560,11 @@ def test_callback_accept_prompted_extra_var(mocker, survey_spec_factory, job_tem dict(extra_vars={"job_launch_var": 3, "survey_var": 4}, host_config_key="foo"), admin_user, expect=201, format='json') assert JobTemplate.create_unified_job.called - assert JobTemplate.create_unified_job.call_args == ({'extra_vars': {'survey_var': 4, - 'job_launch_var': 3}, - 'launch_type': 'callback', - 'limit': 'single-host'},) + assert JobTemplate.create_unified_job.call_args == ({ + 'extra_vars': {'survey_var': 4, 'job_launch_var': 3}, + '_eager_fields': {'launch_type': 'callback'}, + 'limit': 'single-host'}, + ) mock_job.signal_start.assert_called_once() @@ -585,8 +586,10 @@ def test_callback_ignore_unprompted_extra_var(mocker, survey_spec_factory, job_t dict(extra_vars={"job_launch_var": 3, "survey_var": 4}, host_config_key="foo"), admin_user, expect=201, format='json') assert JobTemplate.create_unified_job.called - assert JobTemplate.create_unified_job.call_args == ({'launch_type': 'callback', - 'limit': 'single-host'},) + assert JobTemplate.create_unified_job.call_args == ({ + '_eager_fields': {'launch_type': 'callback'}, + 'limit': 'single-host'}, + ) mock_job.signal_start.assert_called_once()