Remove Python 2 support
Python 2 has been deprecated. This patch removes all traces of six, unicode strings and Python 2 tweaks. Change-Id: I44c7e766173220216fae7d2d94d407175ce0c064
This commit is contained in:
parent
1c4c442525
commit
e52bcb6626
|
@ -36,7 +36,7 @@ source_suffix = '.rst'
|
|||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
copyright = u'2015, Sahara team'
|
||||
copyright = '2015, Sahara team'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -154,8 +154,8 @@ htmlhelp_basename = 'saharaambariplugin-testsdoc'
|
|||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'doc-sahara-plugin-ambari.tex', u'Sahara Ambari Plugin Documentation',
|
||||
u'Sahara team', 'manual'),
|
||||
('index', 'doc-sahara-plugin-ambari.tex', 'Sahara Ambari Plugin Documentation',
|
||||
'Sahara team', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
@ -185,8 +185,8 @@ smartquotes_excludes = {'builders': ['latex']}
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'sahara-plugin-ambari', u'sahara-plugin-ambari Documentation',
|
||||
[u'Sahara team'], 1)
|
||||
('index', 'sahara-plugin-ambari', 'sahara-plugin-ambari Documentation',
|
||||
['Sahara team'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
|
@ -199,8 +199,8 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'sahara-plugin-ambari', u'sahara-plugin-ambari Documentation',
|
||||
u'Sahara team', 'sahara-plugin-ambari', 'One line description of project.',
|
||||
('index', 'sahara-plugin-ambari', 'sahara-plugin-ambari Documentation',
|
||||
'Sahara team', 'sahara-plugin-ambari', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ source_suffix = '.rst'
|
|||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
copyright = u'2015, Sahara Developers'
|
||||
copyright = '2015, Sahara Developers'
|
||||
|
||||
# Release do not need a version number in the title, they
|
||||
# cover multiple versions.
|
||||
|
@ -142,8 +142,8 @@ htmlhelp_basename = 'SaharaAmbariReleaseNotesdoc'
|
|||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'SaharaAmbariReleaseNotes.tex',
|
||||
u'Sahara Ambari Plugin Release Notes Documentation',
|
||||
u'Sahara Developers', 'manual'),
|
||||
'Sahara Ambari Plugin Release Notes Documentation',
|
||||
'Sahara Developers', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
@ -173,8 +173,8 @@ latex_documents = [
|
|||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'saharaambarireleasenotes',
|
||||
u'Sahara Ambari Plugin Release Notes Documentation',
|
||||
[u'Sahara Developers'], 1)
|
||||
'Sahara Ambari Plugin Release Notes Documentation',
|
||||
['Sahara Developers'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
|
@ -188,8 +188,8 @@ man_pages = [
|
|||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'SaharaAmbariReleaseNotes',
|
||||
u'Sahara Ambari Plugin Release Notes Documentation',
|
||||
u'Sahara Developers', 'SaharaAmbariReleaseNotes',
|
||||
'Sahara Ambari Plugin Release Notes Documentation',
|
||||
'Sahara Developers', 'SaharaAmbariReleaseNotes',
|
||||
'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
|
|
@ -16,4 +16,3 @@ oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
|||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
requests>=2.14.2 # Apache-2.0
|
||||
sahara>=10.0.0.0b1
|
||||
six>=1.10.0 # MIT
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from sahara.plugins import provisioning
|
||||
from sahara.plugins import swift_helper
|
||||
|
@ -87,7 +86,7 @@ def get_service_to_configs_map():
|
|||
if SERVICES_TO_CONFIGS_MAP:
|
||||
return SERVICES_TO_CONFIGS_MAP
|
||||
data = {}
|
||||
for (key, item) in six.iteritems(CFG_PROCESS_MAP):
|
||||
for (key, item) in CFG_PROCESS_MAP.items():
|
||||
if item not in data:
|
||||
data[item] = []
|
||||
data[item].append(key)
|
||||
|
@ -140,7 +139,7 @@ def _get_service_name(service):
|
|||
def _get_config_group(group, param, plugin_version):
|
||||
if not CONFIGS or plugin_version not in CONFIGS:
|
||||
load_configs(plugin_version)
|
||||
for section, process in six.iteritems(CFG_PROCESS_MAP):
|
||||
for section, process in CFG_PROCESS_MAP.items():
|
||||
if process == group and param in CONFIGS[plugin_version][section]:
|
||||
return section
|
||||
|
||||
|
@ -239,12 +238,12 @@ def _serialize_ambari_configs(configs):
|
|||
|
||||
def _create_ambari_configs(sahara_configs, plugin_version):
|
||||
configs = {}
|
||||
for service, params in six.iteritems(sahara_configs):
|
||||
for service, params in sahara_configs.items():
|
||||
if service == "general" or service == "Kerberos":
|
||||
# General and Kerberos configs are designed for Sahara, not for
|
||||
# the plugin
|
||||
continue
|
||||
for k, v in six.iteritems(params):
|
||||
for k, v in params.items():
|
||||
group = _get_config_group(service, k, plugin_version)
|
||||
configs.setdefault(group, {})
|
||||
configs[group].update({k: v})
|
||||
|
@ -303,7 +302,7 @@ def get_cluster_params(cluster):
|
|||
def get_config_group(instance):
|
||||
params = get_instance_params_mapping(instance)
|
||||
groups = []
|
||||
for (service, targets) in six.iteritems(get_service_to_configs_map()):
|
||||
for (service, targets) in get_service_to_configs_map().items():
|
||||
current_group = {
|
||||
'cluster_name': instance.cluster.name,
|
||||
'group_name': "%s:%s" % (
|
||||
|
|
|
@ -17,7 +17,6 @@ import collections
|
|||
import functools
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from sahara.plugins import health_check_base
|
||||
from sahara.plugins import utils as plugin_utils
|
||||
|
@ -68,7 +67,7 @@ class AlertsProvider(object):
|
|||
except Exception as e:
|
||||
prefix = _("Can't get response from Ambari Monitor")
|
||||
msg = _("%(problem)s: %(description)s") % {
|
||||
'problem': prefix, 'description': six.text_type(e)}
|
||||
'problem': prefix, 'description': str(e)}
|
||||
# don't put in exception to logs, it will be done by log.exception
|
||||
LOG.exception(prefix)
|
||||
self._exception_store = msg
|
||||
|
|
|
@ -171,7 +171,7 @@ class AmbariClientTestCase(base.SaharaTestCase):
|
|||
resp, True)
|
||||
|
||||
resp.status_code = 200
|
||||
resp.text = u'{"json": "example"}'
|
||||
resp.text = '{"json": "example"}'
|
||||
resp.raise_for_status = mock.Mock()
|
||||
|
||||
res = ambari_client.AmbariClient.check_response(resp)
|
||||
|
@ -186,15 +186,15 @@ class AmbariClientTestCase(base.SaharaTestCase):
|
|||
self.assertRaises(p_exc.HadoopProvisionError,
|
||||
ambari_client.AmbariClient.req_id, resp)
|
||||
|
||||
resp.text = u'{"text" : "example"}'
|
||||
resp.text = '{"text" : "example"}'
|
||||
self.assertRaises(p_exc.HadoopProvisionError,
|
||||
ambari_client.AmbariClient.req_id, resp)
|
||||
|
||||
resp.text = u'{"Requests": {"example" : "text"}}'
|
||||
resp.text = '{"Requests": {"example" : "text"}}'
|
||||
self.assertRaises(p_exc.HadoopProvisionError,
|
||||
ambari_client.AmbariClient.req_id, resp)
|
||||
|
||||
resp.text = u'{"Requests" : {"id" : "test_id"}}'
|
||||
resp.text = '{"Requests" : {"id" : "test_id"}}'
|
||||
res = ambari_client.AmbariClient.req_id(resp)
|
||||
self.assertEqual(res, "test_id")
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
import collections
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
|
||||
from sahara_plugin_ambari.plugins.ambari import configs
|
||||
from sahara_plugin_ambari.tests.unit import base
|
||||
|
@ -77,9 +76,9 @@ class AmbariConfigsTestCase(base.SaharaTestCase):
|
|||
'Falcon': ['falcon-startup.properties',
|
||||
'falcon-runtime.properties', 'falcon-env']
|
||||
}
|
||||
for (key, item) in six.iteritems(configs_map):
|
||||
for (key, item) in configs_map.items():
|
||||
item.sort()
|
||||
for (key, item) in six.iteritems(configs_expected):
|
||||
for (key, item) in configs_expected.items():
|
||||
item.sort()
|
||||
self.assertEqual(configs_map, configs_expected)
|
||||
self.assertIsNotNone(configs.SERVICES_TO_CONFIGS_MAP)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from sahara.plugins import health_check_base
|
||||
|
@ -39,7 +38,7 @@ class TestAmbariHealthCheck(base.SaharaTestCase):
|
|||
self.assertEqual(
|
||||
"Cluster health is %s. Reason: "
|
||||
"Ambari Monitor has responded that cluster "
|
||||
"has %s alert(s)" % (col, count), six.text_type(e))
|
||||
"has %s alert(s)" % (col, count), str(e))
|
||||
raise
|
||||
|
||||
@mock.patch('sahara_plugin_ambari.plugins.ambari.client.AmbariClient.'
|
||||
|
@ -119,5 +118,5 @@ class TestAmbariHealthCheck(base.SaharaTestCase):
|
|||
self.assertEqual(
|
||||
"Cluster health is RED. Reason: "
|
||||
"Can't get response from Ambari Monitor: OOUCH!",
|
||||
six.text_type(e))
|
||||
str(e))
|
||||
raise
|
||||
|
|
Loading…
Reference in New Issue