Convert docker cmd output to native, early

This commit is contained in:
Matt Martz 2017-06-10 08:52:27 -05:00 committed by Toshio Kuratomi
parent a18cc45778
commit 23eebb62e6

View file

@ -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):