From 1b9745722e1c700358b4a24e37d0238127c763fb Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Wed, 20 Feb 2019 16:15:45 -0500 Subject: [PATCH] Fix issues with enable become plugin (#52657) * Work around become_user not being set --- lib/ansible/plugins/action/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 5b28e1125a8..4c28ef215aa 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -291,7 +291,8 @@ class ActionBase(with_metaclass(ABCMeta, object)): # we need to return become_unprivileged as True admin_users = self._get_admin_users() remote_user = self._get_remote_user() - return bool(self.get_become_option('become_user') not in admin_users + [remote_user]) + become_user = self.get_become_option('become_user') + return bool(become_user and become_user not in admin_users + [remote_user]) def _make_tmp_path(self, remote_user=None): '''