Fix ansible-test inventory delegation.

This commit is contained in:
Matt Clay 2020-01-15 14:16:31 -08:00
parent 5c158755fc
commit ebf21bb48d
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now correctly includes inventory files ignored by git when running tests with the ``--docker`` option

View file

@ -170,8 +170,9 @@ def delegate_inventory(args, inventory_path_src): # type: (IntegrationConfig, s
working_path = ''
inventory_path = os.path.join(working_path, get_inventory_relative_path(args))
inventory_tuple = inventory_path_src, inventory_path
if os.path.isfile(inventory_path_src) and os.path.relpath(inventory_path_src, data_context().content.root) != inventory_path:
if os.path.isfile(inventory_path_src) and inventory_tuple not in files:
originals = [item for item in files if item[1] == inventory_path]
if originals:
@ -182,7 +183,7 @@ def delegate_inventory(args, inventory_path_src): # type: (IntegrationConfig, s
else:
display.notice('Sourcing inventory file "%s" from "%s".' % (inventory_path, inventory_path_src))
files.append((inventory_path_src, inventory_path))
files.append(inventory_tuple)
data_context().register_payload_callback(inventory_callback)