Fix ansible-test inventory delegation.

pull/66682/head
Matt Clay 5 years ago
parent 5c158755fc
commit ebf21bb48d

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

@ -170,8 +170,9 @@ def delegate_inventory(args, inventory_path_src): # type: (IntegrationConfig, s
working_path = '' working_path = ''
inventory_path = os.path.join(working_path, get_inventory_relative_path(args)) 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] originals = [item for item in files if item[1] == inventory_path]
if originals: if originals:
@ -182,7 +183,7 @@ def delegate_inventory(args, inventory_path_src): # type: (IntegrationConfig, s
else: else:
display.notice('Sourcing inventory file "%s" from "%s".' % (inventory_path, inventory_path_src)) 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) data_context().register_payload_callback(inventory_callback)

Loading…
Cancel
Save