From ab0f992b3a3dcfc445c2d31491c0439a6d150da7 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Thu, 23 Feb 2017 08:00:34 -0500 Subject: [PATCH] fixes import statement in nxos_facts module (#21834) trying to import from the wrong shared lib, this patch changes network_common to connection. Also fixes a bug found in the nxos action plugin to detect transport fixes #21829 --- lib/ansible/modules/network/nxos/nxos_facts.py | 2 +- lib/ansible/plugins/action/nxos.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index b9a7dc51120..fa00162733e 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -181,7 +181,7 @@ import re from ansible.module_utils.nxos import run_commands from ansible.module_utils.nxos import nxos_argument_spec, check_args from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.network_common import exec_command +from ansible.module_utils.connection import exec_command from ansible.module_utils.six import iteritems diff --git a/lib/ansible/plugins/action/nxos.py b/lib/ansible/plugins/action/nxos.py index 09195bc9c3d..0daff67a45f 100644 --- a/lib/ansible/plugins/action/nxos.py +++ b/lib/ansible/plugins/action/nxos.py @@ -99,7 +99,9 @@ class ActionModule(_ActionModule): self._task.args['provider'] = provider_arg # make sure a transport value is set in args - if self._task.args.get('transport') is None and self._task.args.get('provider').get('transport') is None: + transport = self._task.args.get('transport') + provider_transport = (self._task.args.get('provider') or {}).get('transport') + if all((transport is None, provider_transport is None)): self._task.args['transport'] = 'cli' return super(ActionModule, self).run(tmp, task_vars)