add inventory name and id to meta vars

This commit is contained in:
jainnikhil30
2019-07-05 20:37:36 +05:30
parent d4f50896de
commit 88a4362a7a
3 changed files with 21 additions and 5 deletions

View File

@@ -256,6 +256,7 @@ class TestExtraVarSanitation(TestJobExecution):
def test_vars_unsafe_by_default(self, job, private_data_dir):
job.created_by = User(pk=123, username='angry-spud')
job.inventory = Inventory(pk=123, name='example-inv')
task = tasks.RunJob()
task.build_extra_vars_file(job, private_data_dir)
@@ -268,13 +269,14 @@ class TestExtraVarSanitation(TestJobExecution):
'awx_user_name', 'tower_job_launch_type',
'awx_project_revision',
'tower_project_revision', 'tower_user_name',
'awx_job_launch_type']:
'awx_job_launch_type',
'awx_inventory_name', 'tower_inventory_name']:
assert hasattr(extra_vars[unsafe], '__UNSAFE__')
# ensure that non-strings are marked as safe
for safe in ['awx_job_template_id', 'awx_job_id', 'awx_user_id',
'tower_user_id', 'tower_job_template_id',
'tower_job_id']:
'tower_job_id', 'awx_inventory_id', 'tower_inventory_id']:
assert not hasattr(extra_vars[safe], '__UNSAFE__')