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

Enable UTF-8 commands via the raw module

Paramiko does not allow Unicode strings as parameters, so encode
the command to UTF-8.

Test case:

ansible localhost -m raw -a 'echo ą'

(also tested on local and ssh transports without problems)
This commit is contained in:
Grzegorz Nosek 2012-08-20 21:03:39 +02:00 committed by Michael DeHaan
parent 2aef0335cb
commit 73b0dd4ac0

View file

@ -212,7 +212,7 @@ class Runner(object):
def _execute_raw(self, conn, tmp, inject=None): def _execute_raw(self, conn, tmp, inject=None):
''' execute a non-module command for bootstrapping, or if there's no python on a device ''' ''' execute a non-module command for bootstrapping, or if there's no python on a device '''
return ReturnData(conn=conn, result=dict( return ReturnData(conn=conn, result=dict(
stdout=self._low_level_exec_command(conn, self.module_args, tmp, sudoable = True) stdout=self._low_level_exec_command(conn, self.module_args.encode('utf-8'), tmp, sudoable = True)
)) ))
# *************************************************** # ***************************************************