From ed23424b3282dfd0ccd18f0289a0910cffcfd428 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 25 Aug 2017 10:34:26 -0400 Subject: [PATCH] reverts 28599 --- lib/ansible/playbook/play_context.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index bf55c2ce9af..3e12fd4f611 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -432,11 +432,6 @@ class PlayContext(Base): if exe_var in variables: setattr(new_info, 'executable', variables.get(exe_var)) - # we store original in 'connection_user' for use of network/other modules that fallback to it as login user - # this needs to be done before the MAGIC_VARIABLE_MAPPING happens below - if new_info.connection == 'local': - new_info.connection_user = new_info.remote_user - attrs_considered = [] for (attr, variable_names) in iteritems(MAGIC_VARIABLE_MAPPING): for variable_name in variable_names: @@ -498,7 +493,10 @@ class PlayContext(Base): # 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 + # this needs to be done before the MAGIC_VARIABLE_MAPPING happens if new_info.connection == 'local': + new_info.connection_user = new_info.remote_user new_info.remote_user = pwd.getpwuid(os.getuid()).pw_name # set no_log to default if it was not previouslly set