diff --git a/container_config_scripts/nova_wait_for_api_service.py b/container_config_scripts/nova_wait_for_api_service.py index c030ba14a8..54115c1b11 100755 --- a/container_config_scripts/nova_wait_for_api_service.py +++ b/container_config_scripts/nova_wait_for_api_service.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. import argparse +from configparser import ConfigParser import logging import os -import six import sys import time @@ -27,17 +27,8 @@ from keystoneauth1 import session from novaclient import client from novaclient.exceptions import ClientException -# In python3 SafeConfigParser was renamed to ConfigParser and the default -# for duplicate options default to true. In case of nova it is valid to -# have duplicate option lines, e.g. passthrough_whitelist which leads to -# issues reading the nova.conf -# https://bugs.launchpad.net/tripleo/+bug/1827775 -if six.PY3: - from six.moves.configparser import ConfigParser - config = ConfigParser(strict=False) -else: - from six.moves.configparser import SafeConfigParser - config = SafeConfigParser() + +config = ConfigParser(strict=False) debug = os.getenv('__OS_DEBUG', 'false') diff --git a/container_config_scripts/nova_wait_for_compute_service.py b/container_config_scripts/nova_wait_for_compute_service.py index a1a05ff29e..cbaf9da122 100644 --- a/container_config_scripts/nova_wait_for_compute_service.py +++ b/container_config_scripts/nova_wait_for_compute_service.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. import argparse +from configparser import ConfigParser import logging import os -import six import socket import sys import time @@ -27,17 +27,8 @@ from keystoneauth1 import session from novaclient import client -# In python3 SafeConfigParser was renamed to ConfigParser and the default -# for duplicate options default to true. In case of nova it is valid to -# have duplicate option lines, e.g. passthrough_whitelist which leads to -# issues reading the nova.conf -# https://bugs.launchpad.net/tripleo/+bug/1827775 -if six.PY3: - from six.moves.configparser import ConfigParser - config = ConfigParser(strict=False) -else: - from six.moves.configparser import SafeConfigParser - config = SafeConfigParser() + +config = ConfigParser(strict=False) debug = os.getenv('__OS_DEBUG', 'false') diff --git a/container_config_scripts/placement_wait_for_service.py b/container_config_scripts/placement_wait_for_service.py index 04bbf43191..8f4c660a62 100755 --- a/container_config_scripts/placement_wait_for_service.py +++ b/container_config_scripts/placement_wait_for_service.py @@ -17,10 +17,10 @@ # shell script to check if placement API is up after X attempts. # Default max is 60 iterations with 10s (default) timeout in between. +from configparser import ConfigParser import logging import os import re -import six import sys import time @@ -29,18 +29,8 @@ from keystoneauth1 import session from keystoneclient.v3 import client import requests -# In python3 SafeConfigParser was renamed to ConfigParser and the default -# for duplicate options default to true. In case of nova it is valid to -# have duplicate option lines, e.g. passthrough_whitelist which leads to -# issues reading the nova.conf -# https://bugs.launchpad.net/tripleo/+bug/1827775 -if six.PY3: - from six.moves.configparser import ConfigParser - config = ConfigParser(strict=False) -else: - from six.moves.configparser import SafeConfigParser - config = SafeConfigParser() +config = ConfigParser(strict=False) debug = os.getenv('__OS_DEBUG', 'false') diff --git a/container_config_scripts/tests/test_nova_statedir_ownership.py b/container_config_scripts/tests/test_nova_statedir_ownership.py index 6389ee8579..e0e42400e6 100644 --- a/container_config_scripts/tests/test_nova_statedir_ownership.py +++ b/container_config_scripts/tests/test_nova_statedir_ownership.py @@ -18,7 +18,6 @@ from unittest import mock import contextlib import os from os import stat as orig_stat -import six import stat import sys @@ -375,7 +374,7 @@ class NovaStatedirOwnershipManagerTestCase(base.BaseTestCase): # Determine which paths should change uid/gid expected_changes = {} - for k, v in six.iteritems(testtree): + for k, v in testtree.items(): if k == '/var/lib/nova/upgrade_marker': # Ignore the marker, it should be deleted continue @@ -394,7 +393,7 @@ class NovaStatedirOwnershipManagerTestCase(base.BaseTestCase): with fake_testtree(testtree) as (_, _, _, _, fake_unlink, _, _): NovaStatedirOwnershipManager('/var/lib/nova').run() - for fn, expected in six.iteritems(expected_changes): + for fn, expected in expected_changes.items(): assert_ids(testtree, fn, expected[0], expected[1]) fake_unlink.assert_called_with('/var/lib/nova/upgrade_marker') diff --git a/requirements.txt b/requirements.txt index bda47437c8..180423b340 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,4 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 PyYAML>=3.12 # MIT Jinja2>=2.10 # BSD License (3 clause) -six>=1.10.0 # MIT tripleo-common>=7.1.0 # Apache-2.0 diff --git a/tools/convert_nic_config.py b/tools/convert_nic_config.py index 57ecd08057..1e42fe6933 100755 --- a/tools/convert_nic_config.py +++ b/tools/convert_nic_config.py @@ -17,7 +17,6 @@ import datetime import os import re import shutil -import six import sys import yaml @@ -140,9 +139,9 @@ class TemplateLoader(yaml.SafeLoader): return collections.OrderedDict(self.construct_pairs(node)) -TemplateDumper.add_representer(six.text_type, +TemplateDumper.add_representer(str, TemplateDumper.description_presenter) -TemplateDumper.add_representer(six.binary_type, +TemplateDumper.add_representer(bytes, TemplateDumper.description_presenter) TemplateDumper.add_representer(collections.OrderedDict, diff --git a/tools/merge-new-params-nic-config-script.py b/tools/merge-new-params-nic-config-script.py index c4cd6af410..27f36b9382 100755 --- a/tools/merge-new-params-nic-config-script.py +++ b/tools/merge-new-params-nic-config-script.py @@ -17,7 +17,6 @@ import datetime import os import re import shutil -import six import subprocess import sys import yaml @@ -167,9 +166,9 @@ class TemplateLoader(yaml.SafeLoader): return collections.OrderedDict(self.construct_pairs(node)) -TemplateDumper.add_representer(six.text_type, +TemplateDumper.add_representer(str, TemplateDumper.description_presenter) -TemplateDumper.add_representer(six.binary_type, +TemplateDumper.add_representer(bytes, TemplateDumper.description_presenter) TemplateDumper.add_representer(collections.OrderedDict, diff --git a/tools/process-templates.py b/tools/process-templates.py index 013cac3cdd..903f87e573 100755 --- a/tools/process-templates.py +++ b/tools/process-templates.py @@ -15,7 +15,6 @@ import argparse import jinja2 import os import shutil -import six import sys import yaml @@ -33,7 +32,7 @@ def _shutil_copy_if_not_same(src, dst): try: shutil.copy(src, dst) except Exception as ex: - if 'are the same file' in six.text_type(ex): + if 'are the same file' in str(ex): pass else: raise @@ -98,7 +97,7 @@ def _j2_render_to_file(j2_template, j2_data, outfile_name=None, r_template = template.render(**j2_data) except jinja2.exceptions.TemplateError as ex: error_msg = ("Error rendering template %s : %s" - % (yaml_f, six.text_type(ex))) + % (yaml_f, str(ex))) print(error_msg) raise Exception(error_msg) if not dry_run: diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py index f9fcbfd85c..10532cbf55 100755 --- a/tools/yaml-validate.py +++ b/tools/yaml-validate.py @@ -15,7 +15,6 @@ import argparse import glob import os import re -import six import sys import traceback import yaml @@ -24,7 +23,7 @@ from copy import copy def is_string(value): - return isinstance(value, six.string_types) + return isinstance(value, str) # Only permit the template alias versions. diff --git a/tripleo_heat_templates/tests/test_environment_generator.py b/tripleo_heat_templates/tests/test_environment_generator.py index a81dc4e0ff..b3d951e60f 100644 --- a/tripleo_heat_templates/tests/test_environment_generator.py +++ b/tripleo_heat_templates/tests/test_environment_generator.py @@ -17,7 +17,6 @@ import tempfile from unittest import mock from oslotest import base -import six import testscenarios from tripleo_heat_templates import environment_generator @@ -727,8 +726,8 @@ resource_registry: cls.content_scenarios) def test_generator(self): - fake_input = io.StringIO(six.text_type(self.input_file)) - fake_template = io.StringIO(six.text_type(self.template)) + fake_input = io.StringIO(str(self.input_file)) + fake_template = io.StringIO(str(self.template)) _, fake_output_path = tempfile.mkstemp() fake_output = open(fake_output_path, 'w') with mock.patch('tripleo_heat_templates.environment_generator.open', @@ -740,7 +739,7 @@ resource_registry: if self.nested_output: _, fake_nested_output_path = tempfile.mkstemp() fake_nested_output = open(fake_nested_output_path, 'w') - fake_template2 = io.StringIO(six.text_type(self.template)) + fake_template2 = io.StringIO(str(self.template)) mock_se = [fake_input, fake_template, fake_output, fake_template2, fake_nested_output] mock_open.side_effect = mock_se