1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #12783 from larsks/bug/12782

correct value of remote_user for local connections
This commit is contained in:
Brian Coca 2015-10-22 08:10:07 -04:00
commit 09899b7c43

View file

@ -24,6 +24,7 @@ import shutil
import subprocess import subprocess
import select import select
import fcntl import fcntl
import getpass
import ansible.constants as C import ansible.constants as C
@ -41,6 +42,11 @@ class Connection(ConnectionBase):
def _connect(self, port=None): def _connect(self, port=None):
''' connect to the local host; nothing to do here ''' ''' connect to the local host; nothing to do here '''
# Because we haven't made any remote connection we're running as
# the local user, rather than as whatever is configured in
# remote_user.
self._play_context.remote_user = getpass.getuser()
if not self._connected: if not self._connected:
self._display.vvv("ESTABLISH LOCAL CONNECTION FOR USER: {0}".format(self._play_context.remote_user, host=self._play_context.remote_addr)) self._display.vvv("ESTABLISH LOCAL CONNECTION FOR USER: {0}".format(self._play_context.remote_user, host=self._play_context.remote_addr))
self._connected = True self._connected = True