Don't pollute include_variables (#54687)

* Don't pollute include_variables. Fixes #51667. Fixes #54618.

* Rename include_variables to include_args, so we can make the distinction about what they are

* Track args and vars separately

* oops

* oops again

* linting fix

* Add test
This commit is contained in:
Matt Martz
2019-04-09 10:14:42 -05:00
committed by GitHub
parent dd20c7c04e
commit fbf2d5d2f4
7 changed files with 51 additions and 22 deletions

View File

@@ -51,11 +51,12 @@ def mock_variable_manager():
def test_included_file_instantiation():
filename = 'somefile.yml'
inc_file = IncludedFile(filename=filename, args=[], task=None)
inc_file = IncludedFile(filename=filename, args={}, vars={}, task=None)
assert isinstance(inc_file, IncludedFile)
assert inc_file._filename == filename
assert inc_file._args == []
assert inc_file._args == {}
assert inc_file._vars == {}
assert inc_file._task is None
@@ -84,6 +85,7 @@ def test_process_include_results(mock_iterator, mock_variable_manager):
assert res[0]._filename == os.path.join(os.getcwd(), 'include_test.yml')
assert res[0]._hosts == ['testhost1', 'testhost2']
assert res[0]._args == {}
assert res[0]._vars == {}
def test_process_include_diff_files(mock_iterator, mock_variable_manager):
@@ -124,6 +126,9 @@ def test_process_include_diff_files(mock_iterator, mock_variable_manager):
assert res[0]._args == {}
assert res[1]._args == {}
assert res[0]._vars == {}
assert res[1]._vars == {}
def test_process_include_simulate_free(mock_iterator, mock_variable_manager):
hostname = "testhost1"
@@ -159,3 +164,6 @@ def test_process_include_simulate_free(mock_iterator, mock_variable_manager):
assert res[0]._args == {}
assert res[1]._args == {}
assert res[0]._vars == {}
assert res[1]._vars == {}