* Revert "fixes play context connection user (#21776)"
This reverts commit 58ee661437
.
fixes #23530
* preserve original in copy
updated comment to clarify wtf is going on here
This commit is contained in:
parent
527a7762e1
commit
eb887b8062
1 changed files with 3 additions and 9 deletions
|
@ -439,11 +439,9 @@ class PlayContext(Base):
|
||||||
elif getattr(new_info, 'connection', None) == 'local' and (not remote_addr_local or not inv_hostname_local):
|
elif getattr(new_info, 'connection', None) == 'local' and (not remote_addr_local or not inv_hostname_local):
|
||||||
setattr(new_info, 'connection', C.DEFAULT_TRANSPORT)
|
setattr(new_info, 'connection', C.DEFAULT_TRANSPORT)
|
||||||
|
|
||||||
# if the final connection type is local, reset the remote_user value
|
# if the final connection type is local, reset the remote_user value to that of the currently logged in user
|
||||||
# to that of the currently logged in user, to ensure any become settings
|
# this ensures any become settings are obeyed correctly
|
||||||
# are obeyed correctly
|
# we store original in 'connection_user' for use of network/other modules that fallback to it as login user
|
||||||
# additionally, we need to do this check after final connection has been
|
|
||||||
# correctly set above ...
|
|
||||||
if new_info.connection == 'local':
|
if new_info.connection == 'local':
|
||||||
new_info.connection_user = new_info.remote_user
|
new_info.connection_user = new_info.remote_user
|
||||||
new_info.remote_user = pwd.getpwuid(os.getuid()).pw_name
|
new_info.remote_user = pwd.getpwuid(os.getuid()).pw_name
|
||||||
|
@ -607,10 +605,6 @@ class PlayContext(Base):
|
||||||
if 'become' in prop:
|
if 'become' in prop:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# perserves the user var for local connections
|
|
||||||
if self.connection == 'local' and 'remote_user' in prop:
|
|
||||||
continue
|
|
||||||
|
|
||||||
var_val = getattr(self, prop)
|
var_val = getattr(self, prop)
|
||||||
for var_opt in var_list:
|
for var_opt in var_list:
|
||||||
if var_opt not in variables and var_val is not None:
|
if var_opt not in variables and var_val is not None:
|
||||||
|
|
Loading…
Reference in a new issue