From f9b108e319fe55efa2ea3d9cdf8c447f9eb3993b Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Sat, 25 Feb 2017 15:20:32 -0500 Subject: [PATCH] fixes issue that caused eapi transport setting to get lost (#21919) The eos action didn't properly set provider transport argument for the module. This patch fixes that problem --- lib/ansible/module_utils/eos.py | 6 +++--- lib/ansible/plugins/action/eos.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/eos.py b/lib/ansible/module_utils/eos.py index fa63548fae..44e4dd8865 100644 --- a/lib/ansible/module_utils/eos.py +++ b/lib/ansible/module_utils/eos.py @@ -79,9 +79,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'] == 'eapi': + transport = module.params['transport'] + provider_transport = (module.params['provider'] or {}).get('transport') + if 'eapi' in (transport, provider_transport): conn = Eapi(module) else: conn = Cli(module) diff --git a/lib/ansible/plugins/action/eos.py b/lib/ansible/plugins/action/eos.py index 79f05a9f1a..2739310b41 100644 --- a/lib/ansible/plugins/action/eos.py +++ b/lib/ansible/plugins/action/eos.py @@ -87,6 +87,7 @@ class ActionModule(_ActionModule): else: provider_arg = { + 'transport': 'eapi', 'host': provider.get('host') or self._play_context.remote_addr, 'port': provider.get('port'), 'username': provider.get('username') or self._play_context.connection_user,