Skip to content

Commit

Permalink
Merge pull request ansible#12783 from larsks/bug/12782
Browse files Browse the repository at this point in the history
correct value of remote_user for local connections
  • Loading branch information
bcoca committed Oct 22, 2015
2 parents 54e821c + aa0b753 commit 09899b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ansible/plugins/connection/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import subprocess
import select
import fcntl
import getpass

import ansible.constants as C

Expand All @@ -41,6 +42,11 @@ def transport(self):
def _connect(self, port=None):
''' 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:
self._display.vvv("ESTABLISH LOCAL CONNECTION FOR USER: {0}".format(self._play_context.remote_user, host=self._play_context.remote_addr))
self._connected = True
Expand Down

0 comments on commit 09899b7

Please sign in to comment.