Merge "Avoid double-encoding to bytes"

This commit is contained in:
Jenkins
2017-06-29 13:32:24 +00:00
committed by Gerrit Code Review

View File

@@ -82,8 +82,7 @@ class Connection(SSH.Connection):
# Remote user is normally set, but if it isn't, then default to 'root' # Remote user is normally set, but if it isn't, then default to 'root'
container_user = 'root' container_user = 'root'
if self._play_context.remote_user: if self._play_context.remote_user:
container_user = SSH.to_bytes(self._play_context.remote_user, container_user = self._play_context.remote_user
errors='surrogate_or_strict')
# NOTE(hwoarang) It is important to connect to the container # NOTE(hwoarang) It is important to connect to the container
# without inheriting the host environment as that would interfere # without inheriting the host environment as that would interfere
# with running commands and services inside the container. However, # with running commands and services inside the container. However,
@@ -151,7 +150,7 @@ class Connection(SSH.Connection):
) )
if returncode == 0: if returncode == 0:
pad = os.path.join( pad = os.path.join(
'/proc/%s/root' % stdout.strip(), '/proc/%s/root' % SSH.to_text(stdout.strip()),
path.lstrip(os.sep) path.lstrip(os.sep)
) )
SSH.display.vvv( SSH.display.vvv(