diff --git a/magnum/conductor/handlers/ca_conductor.py b/magnum/conductor/handlers/ca_conductor.py index eb2eee6977..0163ae5e7e 100644 --- a/magnum/conductor/handlers/ca_conductor.py +++ b/magnum/conductor/handlers/ca_conductor.py @@ -25,7 +25,6 @@ from magnum.i18n import _ from magnum import objects from magnum.objects import fields -import six LOG = logging.getLogger(__name__) @@ -53,7 +52,7 @@ class Handler(object): certificate.csr, ca_cert_type, context=context) - if six.PY3 and isinstance(signed_cert, six.binary_type): + if isinstance(signed_cert, bytes): certificate.pem = signed_cert.decode() else: certificate.pem = signed_cert @@ -63,7 +62,7 @@ class Handler(object): ca_cert = cert_manager.get_cluster_ca_certificate( cluster, context=context, ca_cert_type=ca_cert_type) certificate = objects.Certificate.from_object_cluster(cluster) - if six.PY3 and isinstance(ca_cert.get_certificate(), six.binary_type): + if isinstance(ca_cert.get_certificate(), bytes): certificate.pem = ca_cert.get_certificate().decode() else: certificate.pem = ca_cert.get_certificate() @@ -101,13 +100,13 @@ class Handler(object): cluster.status_reason = None except Exception as e: cluster.status = fields.ClusterStatus.UPDATE_FAILED - cluster.status_reason = six.text_type(e) + cluster.status_reason = str(e) cluster.save() conductor_utils.notify_about_cluster_operation( context, taxonomy.ACTION_UPDATE, taxonomy.OUTCOME_FAILURE, cluster) if isinstance(e, exc.HTTPBadRequest): - e = exception.InvalidParameterValue(message=six.text_type(e)) + e = exception.InvalidParameterValue(message=str(e)) raise e raise diff --git a/magnum/conductor/handlers/cluster_conductor.py b/magnum/conductor/handlers/cluster_conductor.py index 34b55c8d70..36e0501151 100644 --- a/magnum/conductor/handlers/cluster_conductor.py +++ b/magnum/conductor/handlers/cluster_conductor.py @@ -15,7 +15,6 @@ from heatclient import exc from oslo_log import log as logging from pycadf import cadftaxonomy as taxonomy -import six from magnum.common import clients from magnum.common import exception @@ -83,14 +82,14 @@ class Handler(object): except Exception as e: cluster.status = fields.ClusterStatus.CREATE_FAILED - cluster.status_reason = six.text_type(e) + cluster.status_reason = str(e) cluster.save() conductor_utils.notify_about_cluster_operation( context, taxonomy.ACTION_CREATE, taxonomy.OUTCOME_FAILURE, cluster) if isinstance(e, exc.HTTPBadRequest): - e = exception.InvalidParameterValue(message=six.text_type(e)) + e = exception.InvalidParameterValue(message=str(e)) raise e raise @@ -160,7 +159,7 @@ class Handler(object): cluster.status_reason = None except Exception as e: cluster.status = fields.ClusterStatus.UPDATE_FAILED - cluster.status_reason = six.text_type(e) + cluster.status_reason = str(e) cluster.save() # Restore the node_count worker_ng.node_count = old_node_count @@ -169,7 +168,7 @@ class Handler(object): context, taxonomy.ACTION_UPDATE, taxonomy.OUTCOME_FAILURE, cluster) if isinstance(e, exc.HTTPBadRequest): - e = exception.InvalidParameterValue(message=six.text_type(e)) + e = exception.InvalidParameterValue(message=str(e)) raise e raise @@ -219,7 +218,7 @@ class Handler(object): context, taxonomy.ACTION_DELETE, taxonomy.OUTCOME_FAILURE, cluster) cluster.status = fields.ClusterStatus.DELETE_FAILED - cluster.status_reason = six.text_type(unexp) + cluster.status_reason = str(unexp) cluster.save() raise @@ -284,17 +283,17 @@ class Handler(object): cluster.status_reason = None except Exception as e: cluster.status = fields.ClusterStatus.UPDATE_FAILED - cluster.status_reason = six.text_type(e) + cluster.status_reason = str(e) cluster.save() nodegroup.node_count = old_node_count nodegroup.status = fields.ClusterStatus.UPDATE_FAILED - nodegroup.status_reason = six.text_type(e) + nodegroup.status_reason = str(e) nodegroup.save() conductor_utils.notify_about_cluster_operation( context, taxonomy.ACTION_UPDATE, taxonomy.OUTCOME_FAILURE, cluster) if isinstance(e, exc.HTTPBadRequest): - e = exception.InvalidParameterValue(message=six.text_type(e)) + e = exception.InvalidParameterValue(message=str(e)) raise e raise @@ -349,16 +348,16 @@ class Handler(object): raise except Exception as e: cluster.status = fields.ClusterStatus.UPDATE_FAILED - cluster.status_reason = six.text_type(e) + cluster.status_reason = str(e) cluster.save() nodegroup.status = fields.ClusterStatus.UPDATE_FAILED - nodegroup.status_reason = six.text_type(e) + nodegroup.status_reason = str(e) nodegroup.save() conductor_utils.notify_about_cluster_operation( context, taxonomy.ACTION_UPDATE, taxonomy.OUTCOME_FAILURE, cluster) if isinstance(e, exc.HTTPBadRequest): - e = exception.InvalidParameterValue(message=six.text_type(e)) + e = exception.InvalidParameterValue(message=str(e)) raise e raise diff --git a/magnum/conductor/handlers/common/cert_manager.py b/magnum/conductor/handlers/common/cert_manager.py index 286639e3cd..80baa2b539 100644 --- a/magnum/conductor/handlers/common/cert_manager.py +++ b/magnum/conductor/handlers/common/cert_manager.py @@ -14,7 +14,6 @@ from oslo_log import log as logging from oslo_utils import encodeutils -import six from magnum.common import cert_manager from magnum.common import exception @@ -26,7 +25,7 @@ import os import shutil import tempfile -CONDUCTOR_CLIENT_NAME = six.u('Magnum-Conductor') +CONDUCTOR_CLIENT_NAME = 'Magnum-Conductor' LOG = logging.getLogger(__name__) CONF = magnum.conf.CONF diff --git a/magnum/conductor/handlers/nodegroup_conductor.py b/magnum/conductor/handlers/nodegroup_conductor.py index dc35777e2d..806771c238 100644 --- a/magnum/conductor/handlers/nodegroup_conductor.py +++ b/magnum/conductor/handlers/nodegroup_conductor.py @@ -18,7 +18,6 @@ import functools from heatclient import exc from oslo_log import log as logging -import six from magnum.common import exception from magnum.common import profiler @@ -86,12 +85,12 @@ class Handler(object): nodegroup.save() except Exception as e: nodegroup.status = fields.ClusterStatus.CREATE_FAILED - nodegroup.status_reason = six.text_type(e) + nodegroup.status_reason = str(e) nodegroup.save() cluster.status = fields.ClusterStatus.UPDATE_FAILED cluster.save() if isinstance(e, exc.HTTPBadRequest): - e = exception.InvalidParameterValue(message=six.text_type(e)) + e = exception.InvalidParameterValue(message=str(e)) raise e raise return nodegroup @@ -110,12 +109,12 @@ class Handler(object): nodegroup.save() except Exception as e: nodegroup.status = fields.ClusterStatus.UPDATE_FAILED - nodegroup.status_reason = six.text_type(e) + nodegroup.status_reason = str(e) nodegroup.save() cluster.status = fields.ClusterStatus.UPDATE_FAILED cluster.save() if isinstance(e, exc.HTTPBadRequest): - e = exception.InvalidParameterValue(message=six.text_type(e)) + e = exception.InvalidParameterValue(message=str(e)) raise e raise @@ -144,7 +143,7 @@ class Handler(object): raise exception.NgOperationInProgress(nodegroup=nodegroup.name) except Exception as e: nodegroup.status = fields.ClusterStatus.DELETE_FAILED - nodegroup.status_reason = six.text_type(e) + nodegroup.status_reason = str(e) nodegroup.save() cluster.status = fields.ClusterStatus.UPDATE_FAILED cluster.save() diff --git a/magnum/conductor/monitors.py b/magnum/conductor/monitors.py index 53602048a0..35eebbed85 100644 --- a/magnum/conductor/monitors.py +++ b/magnum/conductor/monitors.py @@ -16,7 +16,6 @@ import abc from oslo_log import log -import six from magnum.common import profiler import magnum.conf @@ -29,8 +28,7 @@ CONF = magnum.conf.CONF @profiler.trace_cls("rpc") -@six.add_metaclass(abc.ABCMeta) -class MonitorBase(object): +class MonitorBase(object, metaclass=abc.ABCMeta): def __init__(self, context, cluster): self.context = context