Remove six library
The six library was used to bridge the py2 > py3 gap. This library is longer required on branches that do not support Python2. Change-Id: I40cb90bc6bc058dcbf3659b97dbb489b53adb9d3
This commit is contained in:
parent
6f5cf846ed
commit
b522254bc2
@ -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')
|
||||
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user