From 0e7ebf63912a6ca2676c321c97bebca4c402d431 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Wed, 22 Feb 2017 22:07:33 -0500 Subject: [PATCH] fixes issue with setting transport to nxapi (#21811) The nxos action handler did not map the nxapi value to the provider argument properly. There as an additional fix in the nxos shared lib to properly detect nxapi being set --- lib/ansible/module_utils/nxos.py | 6 +++--- lib/ansible/plugins/action/nxos.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py index c73dae19ac3..bf08a4b62ee 100644 --- a/lib/ansible/module_utils/nxos.py +++ b/lib/ansible/module_utils/nxos.py @@ -72,9 +72,9 @@ def get_connection(module): global _DEVICE_CONNECTION if not _DEVICE_CONNECTION: load_params(module) - if 'transport' not in module.params: - conn = Cli(module) - elif module.params['transport'] == 'nxapi': + transport = module.params['transport'] + provider_transport = (module.params['provider'] or {}).get('transport') + if 'nxapi' in (transport, provider_transport): conn = Nxapi(module) else: conn = Cli(module) diff --git a/lib/ansible/plugins/action/nxos.py b/lib/ansible/plugins/action/nxos.py index 51b5215302b..09195bc9c3d 100644 --- a/lib/ansible/plugins/action/nxos.py +++ b/lib/ansible/plugins/action/nxos.py @@ -87,6 +87,7 @@ class ActionModule(_ActionModule): else: provider_arg = { + 'transport': 'nxapi', 'host': self._play_context.remote_addr, 'port': provider.get('port'), 'username': provider.get('username') or self._play_context.connection_user,