Fix tox -epep8 for Python3

This patch is fixing the hook-docker-cmd.py module to support running
when Python3 is the default interpreter. Before this patch, the code was
relying on the "unicode" built-in type which is not present in Python3.
The six.text_type is being used instead.

Change-Id: If44b1ea7497544abbbf16fa75c61e62bcd982328
Closes-Bug: #1643578
This commit is contained in:
Lucas Alvares Gomes 2016-11-21 14:40:21 +00:00
parent 3d2faffe47
commit c57e98d2cf

View File

@ -19,6 +19,7 @@ import subprocess
import sys
import yaml
import six
DOCKER_CMD = os.environ.get('HEAT_DOCKER_CMD', 'docker')
@ -99,7 +100,7 @@ def main(argv=sys.argv):
if key in ['environment', 'volumes', 'volumes_from']:
for value in config[container][key]:
# Somehow the lists get empty values sometimes
if type(value) is unicode and not value.strip():
if type(value) is six.text_type and not value.strip():
continue
cmd.append(docker_arg_map(key, value))
elif key == 'image':