mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 10:27:34 -02:30
8049-expose execution node var for playbook (#13418)
Expose execution node var for playbook --------- Co-authored-by: Lucas Benedito <lbenedit@redhat.com>
This commit is contained in:
@@ -831,6 +831,9 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin, TaskMana
|
|||||||
for name in JOB_VARIABLE_PREFIXES:
|
for name in JOB_VARIABLE_PREFIXES:
|
||||||
r['{}_job_template_id'.format(name)] = self.job_template.pk
|
r['{}_job_template_id'.format(name)] = self.job_template.pk
|
||||||
r['{}_job_template_name'.format(name)] = self.job_template.name
|
r['{}_job_template_name'.format(name)] = self.job_template.name
|
||||||
|
if self.execution_node:
|
||||||
|
for name in JOB_VARIABLE_PREFIXES:
|
||||||
|
r['{}_execution_node'.format(name)] = self.execution_node
|
||||||
return r
|
return r
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -107,7 +107,11 @@ class TestMetaVars:
|
|||||||
result_hash['{}_user_id'.format(name)] = 47
|
result_hash['{}_user_id'.format(name)] = 47
|
||||||
result_hash['{}_inventory_id'.format(name)] = 45
|
result_hash['{}_inventory_id'.format(name)] = 45
|
||||||
result_hash['{}_inventory_name'.format(name)] = 'example-inv'
|
result_hash['{}_inventory_name'.format(name)] = 'example-inv'
|
||||||
assert Job(name='fake-job', pk=42, id=42, launch_type='manual', created_by=maker, inventory=inv).awx_meta_vars() == result_hash
|
result_hash['{}_execution_node'.format(name)] = 'example-exec-node'
|
||||||
|
assert (
|
||||||
|
Job(name='fake-job', pk=42, id=42, launch_type='manual', created_by=maker, inventory=inv, execution_node='example-exec-node').awx_meta_vars()
|
||||||
|
== result_hash
|
||||||
|
)
|
||||||
|
|
||||||
def test_project_update_metavars(self):
|
def test_project_update_metavars(self):
|
||||||
data = Job(
|
data = Job(
|
||||||
|
|||||||
Reference in New Issue
Block a user