mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Enable more network support in ansible-test. (#20372)
* Only start platform instances with tests selected. * Enable ios on Shippable. * Show inventory in explain mode. * Fix indentation of generated network inventory. * Update classification of network module_utils.
This commit is contained in:
parent
97491672e4
commit
3c51ce56fd
3 changed files with 41 additions and 7 deletions
|
@ -183,12 +183,20 @@ def command_network_integration(args):
|
|||
:type args: NetworkIntegrationConfig
|
||||
"""
|
||||
internal_targets = command_integration_filter(args, walk_network_integration_targets())
|
||||
platform_targets = set(a for t in internal_targets for a in t.aliases if a.startswith('network/'))
|
||||
|
||||
if args.platform:
|
||||
instances = [] # type: list [lib.thread.WrappedThread]
|
||||
|
||||
for platform_version in args.platform:
|
||||
platform, version = platform_version.split('/', 1)
|
||||
platform_target = 'network/%s/' % platform
|
||||
|
||||
if platform_target not in platform_targets and 'network/basics/' not in platform_targets:
|
||||
display.warning('Skipping "%s" because selected tests do not target the "%s" platform.' % (
|
||||
platform_version, platform))
|
||||
continue
|
||||
|
||||
instance = lib.thread.WrappedThread(functools.partial(network_run, args, platform, version))
|
||||
instance.daemon = True
|
||||
instance.start()
|
||||
|
@ -202,9 +210,12 @@ def command_network_integration(args):
|
|||
remotes = [instance.wait_for_result() for instance in instances]
|
||||
inventory = network_inventory(remotes)
|
||||
|
||||
filename = 'test/integration/inventory.networking'
|
||||
|
||||
display.info('>>> Inventory: %s\n%s' % (filename, inventory.strip()), verbosity=3)
|
||||
|
||||
if not args.explain:
|
||||
with open('test/integration/inventory.networking', 'w') as inventory_fd:
|
||||
display.info('>>> Inventory: %s\n%s' % (inventory_fd.name, inventory.strip()), verbosity=3)
|
||||
with open(filename, 'w') as inventory_fd:
|
||||
inventory_fd.write(inventory)
|
||||
else:
|
||||
install_command_requirements(args)
|
||||
|
@ -258,12 +269,12 @@ def network_inventory(remotes):
|
|||
for group in groups:
|
||||
hosts = '\n'.join(groups[group])
|
||||
|
||||
template += """
|
||||
template += textwrap.dedent("""
|
||||
[%s]
|
||||
%s
|
||||
""" % (group, hosts)
|
||||
""") % (group, hosts)
|
||||
|
||||
inventory = textwrap.dedent(template)
|
||||
inventory = template
|
||||
|
||||
return inventory
|
||||
|
||||
|
@ -291,9 +302,12 @@ def command_windows_integration(args):
|
|||
remotes = [instance.wait_for_result() for instance in instances]
|
||||
inventory = windows_inventory(remotes)
|
||||
|
||||
filename = 'test/integration/inventory.winrm'
|
||||
|
||||
display.info('>>> Inventory: %s\n%s' % (filename, inventory.strip()), verbosity=3)
|
||||
|
||||
if not args.explain:
|
||||
with open('test/integration/inventory.winrm', 'w') as inventory_fd:
|
||||
display.info('>>> Inventory: %s\n%s' % (inventory_fd.name, inventory.strip()), verbosity=3)
|
||||
with open(filename, 'w') as inventory_fd:
|
||||
inventory_fd.write(inventory)
|
||||
else:
|
||||
install_command_requirements(args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue