@ -45,7 +45,7 @@ except ImportError:
from ansible import constants as C
from ansible import constants as C
from ansible import errors
from ansible import errors
from ansible . module_utils . _text import to_bytes
from ansible . module_utils . _text import to_bytes , to_native
from ansible . plugins . connection import ConnectionBase
from ansible . plugins . connection import ConnectionBase
@ -116,8 +116,9 @@ class Connection(ConnectionBase):
''' run a command on the chroot '''
''' run a command on the chroot '''
super ( Connection , self ) . exec_command ( cmd , in_data = in_data , sudoable = sudoable )
super ( Connection , self ) . exec_command ( cmd , in_data = in_data , sudoable = sudoable )
executable = to_bytes ( self . _play_context . executable , errors = ' surrogate_or_strict ' )
# python2-lxc needs bytes. python3-lxc needs text.
local_cmd = [ executable , ' -c ' , to_bytes ( cmd , errors = ' surrogate_or_strict ' ) ]
executable = to_native ( self . _play_context . executable , errors = ' surrogate_or_strict ' )
local_cmd = [ executable , ' -c ' , to_native ( cmd , errors = ' surrogate_or_strict ' ) ]
read_stdout , write_stdout = None , None
read_stdout , write_stdout = None , None
read_stderr , write_stderr = None , None
read_stderr , write_stderr = None , None