diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2017-04-20 18:03:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-20 18:03:03 -0400 |
commit | eb887b8062b58866671871b3cd997f8bce67d0fd (patch) | |
tree | fa7e3569d6e86e7aa7b4b168471ec9ce699771c1 | |
parent | 527a7762e105fcbac1a3ea4ac603362dedc9d2f6 (diff) | |
download | ansible-eb887b8062b58866671871b3cd997f8bce67d0fd.tar.gz |
Revert "fixes play context connection user (#21776)" (#23830)
* Revert "fixes play context connection user (#21776)"
This reverts commit 58ee661437f123fdd8cf516bac053fe593910ced.
fixes #23530
* preserve original in copy
updated comment to clarify wtf is going on here
-rw-r--r-- | lib/ansible/playbook/play_context.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index ced3c5140d..f9e6276bad 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -439,11 +439,9 @@ class PlayContext(Base): elif getattr(new_info, 'connection', None) == 'local' and (not remote_addr_local or not inv_hostname_local): setattr(new_info, 'connection', C.DEFAULT_TRANSPORT) - # if the final connection type is local, reset the remote_user value - # to that of the currently logged in user, to ensure any become settings - # are obeyed correctly - # additionally, we need to do this check after final connection has been - # correctly set above ... + # if the final connection type is local, reset the remote_user value to that of the currently logged in user + # this ensures any become settings are obeyed correctly + # we store original in 'connection_user' for use of network/other modules that fallback to it as login user if new_info.connection == 'local': new_info.connection_user = new_info.remote_user new_info.remote_user = pwd.getpwuid(os.getuid()).pw_name @@ -607,10 +605,6 @@ class PlayContext(Base): if 'become' in prop: continue - # perserves the user var for local connections - if self.connection == 'local' and 'remote_user' in prop: - continue - var_val = getattr(self, prop) for var_opt in var_list: if var_opt not in variables and var_val is not None: |