diff --git a/lib/ansible/plugins/connection/docker.py b/lib/ansible/plugins/connection/docker.py index 89bcae030f..6f2c44db24 100644 --- a/lib/ansible/plugins/connection/docker.py +++ b/lib/ansible/plugins/connection/docker.py @@ -35,7 +35,7 @@ from distutils.version import LooseVersion import ansible.constants as C from ansible.errors import AnsibleError, AnsibleFileNotFound from ansible.module_utils.six.moves import shlex_quote -from ansible.module_utils._text import to_bytes +from ansible.module_utils._text import to_bytes, to_native from ansible.plugins.connection import ConnectionBase, BUFSIZE @@ -113,7 +113,7 @@ class Connection(ConnectionBase): p = subprocess.Popen(old_docker_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) cmd_output, err = p.communicate() - return old_docker_cmd, cmd_output, err, p.returncode + return old_docker_cmd, to_native(cmd_output), err, p.returncode def _new_docker_version(self): # no result yet, must be newer Docker version @@ -126,7 +126,7 @@ class Connection(ConnectionBase): new_docker_cmd = [self.docker_cmd] + cmd_args + new_version_subcommand p = subprocess.Popen(new_docker_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) cmd_output, err = p.communicate() - return new_docker_cmd, cmd_output, err, p.returncode + return new_docker_cmd, to_native(cmd_output), err, p.returncode def _get_docker_version(self):