summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2020-02-20 10:01:09 -0800
committerMatt Clay <matt@mystile.com>2020-02-20 15:13:39 -0800
commit65646179f1b45787c19a7aae13ccd50fe2c86631 (patch)
tree2cd5e8cbcfc570f50dd59759e58d3d6637bd5e20
parent854925b0724ea6507c55a66cf340c23438de55b5 (diff)
downloadansible-65646179f1b45787c19a7aae13ccd50fe2c86631.tar.gz
Fix become for network_cli in collections.
-rw-r--r--changelogs/fragments/network-cli-become-collections.yml2
-rw-r--r--lib/ansible/plugins/action/__init__.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/changelogs/fragments/network-cli-become-collections.yml b/changelogs/fragments/network-cli-become-collections.yml
new file mode 100644
index 0000000000..465a1f63bc
--- /dev/null
+++ b/changelogs/fragments/network-cli-become-collections.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - Skipping of become for ``network_cli`` connections now works when ``network_cli`` is sourced from a collection.
diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py
index 1b8689dbe9..d1b034d763 100644
--- a/lib/ansible/plugins/action/__init__.py
+++ b/lib/ansible/plugins/action/__init__.py
@@ -1048,7 +1048,7 @@ class ActionBase(with_metaclass(ABCMeta, object)):
ruser = self._get_remote_user()
buser = self.get_become_option('become_user')
if (sudoable and self._connection.become and # if sudoable and have become
- self._connection.transport != 'network_cli' and # if not using network_cli
+ self._connection.transport.split('.')[-1] != 'network_cli' and # if not using network_cli
(C.BECOME_ALLOW_SAME_USER or (buser != ruser or not any((ruser, buser))))): # if we allow same user PE or users are different and either is set
display.debug("_low_level_execute_command(): using become for this command")
cmd = self._connection.become.build_become_command(cmd, self._connection._shell)