diff --git a/heat-config-chef/install.d/hook-chef.py b/heat-config-chef/install.d/hook-chef.py index 41ef4e7..baeae3f 100755 --- a/heat-config-chef/install.d/hook-chef.py +++ b/heat-config-chef/install.d/hook-chef.py @@ -16,7 +16,6 @@ import json import logging import os import shutil -import six import subprocess import sys @@ -41,7 +40,7 @@ def prepare_dir(path): def run_subproc(fn, **kwargs): env = os.environ.copy() for k, v in kwargs.items(): - env[six.text_type(k)] = v + env[str(k)] = v try: subproc = subprocess.Popen(fn, stdout=subprocess.PIPE, stderr=subprocess.PIPE, @@ -49,7 +48,7 @@ def run_subproc(fn, **kwargs): stdout, stderr = subproc.communicate() except OSError as exc: ret = -1 - stderr = six.text_type(exc) + stderr = str(exc) stdout = "" else: ret = subproc.returncode diff --git a/heat-config-docker-compose/install.d/hook-docker-compose.py b/heat-config-docker-compose/install.d/hook-docker-compose.py index c2ea093..d7472fe 100755 --- a/heat-config-docker-compose/install.d/hook-docker-compose.py +++ b/heat-config-docker-compose/install.d/hook-docker-compose.py @@ -16,7 +16,6 @@ import ast import json import logging import os -import six import subprocess import sys import yaml @@ -88,7 +87,7 @@ def main(argv=sys.argv): value = c.get('env_file', None) if isinstance(value, list): compose_env_files.extend(value) - elif isinstance(value, six.string_types): + elif isinstance(value, str): compose_env_files.extend([value]) input_env_files = {} diff --git a/heat-config-kubelet/install.d/hook-kubelet.py b/heat-config-kubelet/install.d/hook-kubelet.py index e159367..6634545 100755 --- a/heat-config-kubelet/install.d/hook-kubelet.py +++ b/heat-config-kubelet/install.d/hook-kubelet.py @@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. +import io import json import logging import os import re -import six import sys import time @@ -81,13 +81,13 @@ def configure_logging(): handler.setFormatter(formatter) log.addHandler(handler) - deploy_stdout = six.StringIO() + deploy_stdout = io.StringIO() handler = logging.StreamHandler(deploy_stdout) handler.setFormatter(formatter) handler.setLevel('DEBUG') log.addHandler(handler) - deploy_stderr = six.StringIO() + deploy_stderr = io.StringIO() handler = logging.StreamHandler(deploy_stderr) handler.setFormatter(formatter) handler.setLevel('WARN') @@ -149,7 +149,7 @@ def wait_required_containers(client, log, waiting_for = dict((v, re.compile(v)) for v in patterns) while waiting_for: for name in containers_names(client.containers()): - for k, v in six.iteritems(waiting_for): + for k, v in waiting_for.items(): if v.match(name): log.info('Pattern %s matches: %s' % (k, name)) del(waiting_for[k]) diff --git a/heat-config/os-refresh-config/configure.d/55-heat-config b/heat-config/os-refresh-config/configure.d/55-heat-config index 9227362..5819f88 100755 --- a/heat-config/os-refresh-config/configure.d/55-heat-config +++ b/heat-config/os-refresh-config/configure.d/55-heat-config @@ -20,7 +20,6 @@ import stat import subprocess import sys -import six import yaml # legacy groups that have never had a hook script @@ -109,7 +108,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'], six.string_types): + not isinstance(hot_input['value'], str): 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 diff --git a/tests/test_heat_config.py b/tests/test_heat_config.py index 852259d..63e2be0 100644 --- a/tests/test_heat_config.py +++ b/tests/test_heat_config.py @@ -15,7 +15,6 @@ import copy import json import os import shutil -import six import tempfile import fixtures @@ -238,7 +237,7 @@ class HeatConfigTest(common.RunScriptTest): notify_data = self.json_from_file(notify_file) self.assertEqual( self.outputs[hook]['deploy_status_code'], - six.text_type(notify_data['deploy_status_code'])) + str(notify_data['deploy_status_code'])) self.assertIn( self.outputs[hook]['deploy_stderr'], notify_data['deploy_stderr']) diff --git a/tests/test_heat_config_notify.py b/tests/test_heat_config_notify.py index 2806540..65ebf68 100644 --- a/tests/test_heat_config_notify.py +++ b/tests/test_heat_config_notify.py @@ -12,11 +12,11 @@ # under the License. import copy +import io import json import tempfile import fixtures -import six from unittest import mock from tests import common @@ -80,7 +80,7 @@ class HeatConfigNotifyTest(common.RunScriptTest): super(HeatConfigNotifyTest, self).setUp() self.deployed_dir = self.useFixture(fixtures.TempDir()) hcn.init_logging = mock.MagicMock() - self.stdin = six.StringIO() + self.stdin = io.StringIO() def write_config_file(self, data): config_file = tempfile.NamedTemporaryFile(mode='w') diff --git a/tests/test_hook_chef.py b/tests/test_hook_chef.py index 8a2e8ee..348c814 100644 --- a/tests/test_hook_chef.py +++ b/tests/test_hook_chef.py @@ -13,9 +13,9 @@ import copy import importlib +import io import json import logging -import six import sys from multiprocessing import Lock @@ -69,8 +69,8 @@ class HookChefTest(common.RunScriptTest): __file__, '..', 'heat-config-chef/install.d/hook-chef.py') - sys.stdin = six.StringIO() - sys.stdout = six.StringIO() + sys.stdin = io.StringIO() + sys.stdout = io.StringIO() def tearDown(self): super(HookChefTest, self).tearDown()