Fix undefined basestring and unicode in py35
In py3 basestring and unicode are no longer valid, and should use `str` instead. In order to cover py2 and py3, we change to use six lib to cover both. Closes-Bug: #1682015 Change-Id: I3159470965e3a20161ff0e997af625b45ebe21fa
This commit is contained in:
parent
1351cc322b
commit
e4df67e265
@ -15,6 +15,7 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import six
|
||||
import subprocess
|
||||
import sys
|
||||
import yaml
|
||||
@ -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':
|
||||
|
@ -17,6 +17,7 @@ import dpath
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import six
|
||||
import subprocess
|
||||
import sys
|
||||
import yaml
|
||||
@ -87,7 +88,7 @@ def main(argv=sys.argv):
|
||||
for value in dpath.util.values(config, '*/env_file'):
|
||||
if isinstance(value, list):
|
||||
compose_env_files.extend(value)
|
||||
elif isinstance(value, basestring):
|
||||
elif isinstance(value, six.string_types):
|
||||
compose_env_files.extend([value])
|
||||
|
||||
input_env_files = {}
|
||||
|
@ -21,6 +21,7 @@ import subprocess
|
||||
import sys
|
||||
|
||||
import requests
|
||||
import six
|
||||
|
||||
HOOKS_DIR_PATHS = (
|
||||
os.environ.get('HEAT_CONFIG_HOOKS'),
|
||||
@ -93,7 +94,7 @@ def invoke_hook(c, log):
|
||||
hot_inputs = c.get('inputs', [])
|
||||
for hot_input in hot_inputs:
|
||||
if hot_input.get('type', None) == 'String' and \
|
||||
not isinstance(hot_input['value'], basestring):
|
||||
not isinstance(hot_input['value'], six.text_type):
|
||||
hot_input['value'] = str(hot_input['value'])
|
||||
iv = dict((i['name'], i['value']) for i in c['inputs'])
|
||||
# The group property indicates whether it is softwarecomponent or
|
||||
|
Loading…
Reference in New Issue
Block a user