Merge "Remove the six library"
This commit is contained in:
commit
222ba53911
@ -113,7 +113,7 @@ ignore-mixin-members=yes
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis
|
||||
ignored-modules=distutils,eventlet.green.subprocess,six,six.moves
|
||||
ignored-modules=distutils,eventlet.green.subprocess
|
||||
|
||||
# List of classes names for which member attributes should not be checked
|
||||
# (useful for classes with attributes dynamically set).
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017-2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2017-2021, 2024 Wind River Systems, Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
@ -16,16 +16,13 @@ Base class for all drivers.
|
||||
"""
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DriverBase(object):
|
||||
|
||||
six.add_metaclass(abc.ABCMeta)
|
||||
class DriverBase(object, metaclass=abc.ABCMeta):
|
||||
"""Base class for all drivers."""
|
||||
|
||||
def __init__(self, context):
|
||||
|
@ -18,9 +18,7 @@
|
||||
"""
|
||||
DC Orchestrator base exception handling.
|
||||
"""
|
||||
import six
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
|
||||
from dcorch.common.i18n import _
|
||||
@ -47,10 +45,6 @@ class DCCommonException(Exception):
|
||||
# at least get the core message out if something happened
|
||||
super(DCCommonException, self).__init__(self.message)
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return encodeutils.exception_to_unicode(self.msg)
|
||||
|
||||
def use_fatal_exceptions(self):
|
||||
return False
|
||||
|
||||
|
@ -3,13 +3,14 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import http.client as httplib
|
||||
|
||||
from kubernetes import __version__ as K8S_MODULE_VERSION
|
||||
from kubernetes import client
|
||||
from kubernetes.client import Configuration
|
||||
from kubernetes.client.rest import ApiException
|
||||
from kubernetes import config
|
||||
from oslo_log import log as logging
|
||||
from six.moves import http_client as httplib
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -19,14 +19,14 @@ import shutil
|
||||
import socket
|
||||
import tempfile
|
||||
import threading
|
||||
import urllib.error as urllib_error
|
||||
from urllib import parse
|
||||
from urllib import request
|
||||
|
||||
from eventlet.green import subprocess
|
||||
import netaddr
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from six.moves.urllib import error as urllib_error
|
||||
from six.moves.urllib import parse
|
||||
from six.moves.urllib import request
|
||||
|
||||
from dccommon import consts
|
||||
from dccommon.drivers.openstack.sdk_platform import (
|
||||
|
@ -22,9 +22,7 @@
|
||||
"""
|
||||
DBsync agent base exception handling.
|
||||
"""
|
||||
import six
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
|
||||
from dcdbsync.common.i18n import _
|
||||
@ -51,10 +49,6 @@ class DBsyncException(Exception):
|
||||
# at least get the core message out if something happened
|
||||
super(DBsyncException, self).__init__(self.message)
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return encodeutils.exception_to_unicode(self.msg)
|
||||
|
||||
def use_fatal_exceptions(self):
|
||||
return False
|
||||
|
||||
|
@ -12,13 +12,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Copyright (c) 2019 Wind River Systems, Inc.
|
||||
# Copyright (c) 2019, 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import six
|
||||
|
||||
from dcdbsync.dbsyncclient.v1 import client as client_v1
|
||||
|
||||
|
||||
@ -28,7 +26,7 @@ def Client(dbsync_agent_url=None, username=None, api_key=None,
|
||||
auth_token=None, user_id=None, cacert=None, insecure=False,
|
||||
profile=None, auth_type='keystone', client_id=None,
|
||||
client_secret=None, session=None, **kwargs):
|
||||
if dbsync_agent_url and not isinstance(dbsync_agent_url, six.string_types):
|
||||
if dbsync_agent_url and not isinstance(dbsync_agent_url, str):
|
||||
raise RuntimeError('DC DBsync agent url should be a string.')
|
||||
|
||||
return client_v1.Client(
|
||||
|
@ -22,7 +22,6 @@
|
||||
import keystoneauth1.identity.generic as auth_plugin
|
||||
from keystoneauth1 import session as ks_session
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
from dcdbsync.dbsyncclient import httpclient
|
||||
from dcdbsync.dbsyncclient.v1.identity import identity_group_manager as igm
|
||||
@ -49,8 +48,7 @@ class Client(object):
|
||||
profile=None, auth_type='keystone', client_id=None,
|
||||
client_secret=None, session=None, **kwargs):
|
||||
"""Communicates with Keystone to fetch necessary values."""
|
||||
if dbsync_agent_url and not isinstance(dbsync_agent_url,
|
||||
six.string_types):
|
||||
if dbsync_agent_url and not isinstance(dbsync_agent_url, str):
|
||||
raise RuntimeError('DC DBsync agent url should be a string.')
|
||||
|
||||
if auth_url or session:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2015 Huawei Tech. Co., Ltd.
|
||||
# Copyright (c) 2017-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2017-2022, 2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
@ -19,7 +19,6 @@ import abc
|
||||
|
||||
from pecan import expose
|
||||
from pecan import request
|
||||
import six
|
||||
|
||||
import dcmanager.common.context as k_context
|
||||
|
||||
@ -74,8 +73,7 @@ def _is_generic_handler(obj):
|
||||
return "generic_handler" in data.keys()
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class GenericPathController(object):
|
||||
class GenericPathController(object, metaclass=abc.ABCMeta):
|
||||
"""A controller that allows path parameters to be equal to handler names.
|
||||
|
||||
The _route method provides a custom route resolution that checks if the
|
||||
|
@ -5,17 +5,13 @@
|
||||
#
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
|
||||
|
||||
class Auditor(object):
|
||||
class Auditor(object, metaclass=abc.ABCMeta):
|
||||
"""Abstract class that manages tasks related to types of audits."""
|
||||
|
||||
# todo(abailey): determine if add_metaclass is still required
|
||||
six.add_metaclass(abc.ABCMeta)
|
||||
|
||||
def __init__(self, context, dcmanager_state_rpc_client, endpoint_type):
|
||||
self.context = context
|
||||
self.state_rpc_client = dcmanager_state_rpc_client
|
||||
@ -44,12 +40,3 @@ class Auditor(object):
|
||||
@abc.abstractmethod
|
||||
def get_regionone_audit_data(self):
|
||||
"""Query RegionOne for audit information to compare against."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def subcloud_audit(self, subcloud_name, region_one_audit_data):
|
||||
"""Query Subcloud audit information and compare with regionone data
|
||||
|
||||
This method is responsible for calling:
|
||||
- set_sc_endpoint_in_sync
|
||||
- set_sc_endpoint_out_of_sync
|
||||
"""
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@ -19,7 +19,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_service import service
|
||||
import six
|
||||
|
||||
from dcmanager.audit.subcloud_audit_manager import SubcloudAuditManager
|
||||
from dcmanager.audit.subcloud_audit_worker_manager import SubcloudAuditWorkerManager
|
||||
@ -95,7 +94,7 @@ class DCManagerAuditService(service.Service):
|
||||
self._rpc_server.wait()
|
||||
LOG.info("Engine service stopped successfully")
|
||||
except Exception as ex:
|
||||
LOG.error("Failed to stop engine service: %s", six.text_type(ex))
|
||||
LOG.error("Failed to stop engine service: %s", str(ex))
|
||||
|
||||
def stop(self):
|
||||
self._stop_rpc_server()
|
||||
@ -219,9 +218,7 @@ class DCManagerAuditWorkerService(service.Service):
|
||||
self._rpc_server.wait()
|
||||
LOG.info("Audit-worker RPC service stopped successfully")
|
||||
except Exception as ex:
|
||||
LOG.error(
|
||||
"Failed to stop audit-worker RPC service: %s", six.text_type(ex)
|
||||
)
|
||||
LOG.error("Failed to stop audit-worker RPC service: %s", str(ex))
|
||||
|
||||
def stop(self):
|
||||
self._stop_rpc_server()
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
import re
|
||||
import time
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from oslo_context import context as base_context
|
||||
from oslo_log import log
|
||||
@ -23,7 +24,6 @@ from oslo_utils import encodeutils
|
||||
from oslo_utils import uuidutils
|
||||
import pecan
|
||||
from pecan import hooks
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
from dcmanager.api.policies import base as base_policy
|
||||
from dcmanager.api import policy
|
||||
|
@ -19,9 +19,7 @@
|
||||
"""
|
||||
DC Manager base exception handling.
|
||||
"""
|
||||
import six
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
|
||||
from dcmanager.common.i18n import _
|
||||
@ -48,10 +46,6 @@ class DCManagerException(Exception):
|
||||
# at least get the core message out if something happened
|
||||
super(DCManagerException, self).__init__(self.message)
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return encodeutils.exception_to_unicode(self.msg)
|
||||
|
||||
def use_fatal_exceptions(self):
|
||||
return False
|
||||
|
||||
|
@ -37,7 +37,6 @@ from oslo_log import log as logging
|
||||
from oslo_serialization import base64
|
||||
import pecan
|
||||
import requests
|
||||
import six.moves
|
||||
import tsconfig.tsconfig as tsc
|
||||
import yaml
|
||||
|
||||
@ -98,7 +97,7 @@ def get_import_path(cls):
|
||||
# Returns a iterator of tuples containing batch_size number of objects in each
|
||||
def get_batch_projects(batch_size, project_list, fillvalue=None):
|
||||
args = [iter(project_list)] * batch_size
|
||||
return six.moves.zip_longest(fillvalue=fillvalue, *args)
|
||||
return itertools.zip_longest(fillvalue=fillvalue, *args)
|
||||
|
||||
|
||||
def validate_address_str(ip_address_str, network):
|
||||
@ -737,7 +736,7 @@ def get_region_from_subcloud_address(payload):
|
||||
stderr=subprocess.STDOUT).decode('utf-8')
|
||||
if len(task) < 1:
|
||||
err_cause = ("Malformed subcloud region")
|
||||
return (subcloud_region, err_cause)
|
||||
return subcloud_region, err_cause
|
||||
subcloud_region = str(task.split("=")[1]).strip()
|
||||
except Exception as e:
|
||||
# check_output() will raise CalledProcessError if the called
|
||||
|
@ -18,8 +18,6 @@ import functools
|
||||
import os
|
||||
import threading
|
||||
|
||||
import six
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -379,8 +377,7 @@ class DCManagerService(service.Service):
|
||||
self._rpc_server.wait()
|
||||
LOG.info('RPC service stopped successfully')
|
||||
except Exception as ex:
|
||||
LOG.error('Failed to stop RPC service: %s',
|
||||
six.text_type(ex))
|
||||
LOG.error('Failed to stop RPC service: %s', str(ex))
|
||||
|
||||
def stop(self):
|
||||
SubprocessCleanup.shutdown_cleanup(origin="service")
|
||||
|
@ -20,7 +20,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_service import service
|
||||
import six
|
||||
|
||||
from dccommon.subprocess_cleanup import SubprocessCleanup
|
||||
from dcmanager.common import consts
|
||||
@ -92,8 +91,7 @@ class DCManagerOrchestratorService(service.Service):
|
||||
self._rpc_server = None
|
||||
LOG.info('RPC service stopped successfully')
|
||||
except Exception as ex:
|
||||
LOG.error('Failed to stop engine service: %s',
|
||||
six.text_type(ex))
|
||||
LOG.error('Failed to stop engine service: %s', str(ex))
|
||||
|
||||
def stop(self):
|
||||
"""Stop anything initiated by start"""
|
||||
|
@ -3,8 +3,8 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -25,8 +25,7 @@ from dcmanager.common import utils
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseState(object):
|
||||
class BaseState(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, next_state, region_name):
|
||||
super(BaseState, self).__init__()
|
||||
|
@ -23,7 +23,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_service import service
|
||||
import six
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcmanager.audit import rpcapi as dcmanager_audit_rpc_client
|
||||
@ -100,7 +99,7 @@ class DCManagerStateService(service.Service):
|
||||
self._rpc_server.wait()
|
||||
LOG.info("Engine service stopped successfully")
|
||||
except Exception as ex:
|
||||
LOG.error("Failed to stop engine service: %s", six.text_type(ex))
|
||||
LOG.error("Failed to stop engine service: %s", str(ex))
|
||||
|
||||
def stop(self):
|
||||
LOG.info("Stopping %s", self.__class__.__name__)
|
||||
|
@ -11,7 +11,6 @@ import os
|
||||
|
||||
import mock
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcmanager.common import consts
|
||||
@ -170,12 +169,15 @@ def test_validate_admin_config_subnet_small(self):
|
||||
admin_end_address = "192.168.205.50"
|
||||
admin_gateway_address = "192.168.205.1"
|
||||
|
||||
six.assertRaisesRegex(
|
||||
self, Exception, "Subnet too small*",
|
||||
psd_common.validate_admin_network_config, admin_subnet, admin_start_address,
|
||||
admin_end_address, admin_gateway_address, existing_networks=None,
|
||||
operation=None
|
||||
)
|
||||
with self.assertRaisesRegex(Exception, "Subnet too small*"):
|
||||
psd_common.validate_admin_network_config(
|
||||
admin_subnet,
|
||||
admin_start_address,
|
||||
admin_end_address,
|
||||
admin_gateway_address,
|
||||
existing_networks=None,
|
||||
operation=None,
|
||||
)
|
||||
|
||||
|
||||
def test_validate_admin_config_start_address_outOfSubnet(self):
|
||||
@ -184,12 +186,15 @@ def test_validate_admin_config_start_address_outOfSubnet(self):
|
||||
admin_end_address = "192.168.205.50"
|
||||
admin_gateway_address = "192.168.205.1"
|
||||
|
||||
six.assertRaisesRegex(
|
||||
self, Exception, "Address must be in subnet*",
|
||||
psd_common.validate_admin_network_config,
|
||||
admin_subnet, admin_start_address, admin_end_address, admin_gateway_address,
|
||||
existing_networks=None, operation=None
|
||||
)
|
||||
with self.assertRaisesRegex(Exception, "Address must be in subnet*"):
|
||||
psd_common.validate_admin_network_config(
|
||||
admin_subnet,
|
||||
admin_start_address,
|
||||
admin_end_address,
|
||||
admin_gateway_address,
|
||||
existing_networks=None,
|
||||
operation=None,
|
||||
)
|
||||
|
||||
|
||||
def test_validate_admin_config_end_address_outOfSubnet(self):
|
||||
@ -198,19 +203,25 @@ def test_validate_admin_config_end_address_outOfSubnet(self):
|
||||
admin_end_address = "192.168.205.50"
|
||||
admin_gateway_address = "192.168.205.1"
|
||||
|
||||
six.assertRaisesRegex(
|
||||
self, Exception, "Address must be in subnet*",
|
||||
psd_common.validate_admin_network_config,
|
||||
admin_subnet, admin_start_address, admin_end_address, admin_gateway_address,
|
||||
existing_networks=None, operation=None
|
||||
)
|
||||
with self.assertRaisesRegex(Exception, "Address must be in subnet*"):
|
||||
psd_common.validate_admin_network_config(
|
||||
admin_subnet,
|
||||
admin_start_address,
|
||||
admin_end_address,
|
||||
admin_gateway_address,
|
||||
existing_networks=None,
|
||||
operation=None,
|
||||
)
|
||||
|
||||
admin_end_address = "192.168.205.12"
|
||||
admin_gateway_address = "192.168.205.50"
|
||||
|
||||
six.assertRaisesRegex(
|
||||
self, Exception, "Address must be in subnet*",
|
||||
psd_common.validate_admin_network_config, admin_subnet, admin_start_address,
|
||||
admin_end_address, admin_gateway_address, existing_networks=None,
|
||||
operation=None
|
||||
)
|
||||
with self.assertRaisesRegex(Exception, "Address must be in subnet*"):
|
||||
psd_common.validate_admin_network_config(
|
||||
admin_subnet,
|
||||
admin_start_address,
|
||||
admin_end_address,
|
||||
admin_gateway_address,
|
||||
existing_networks=None,
|
||||
operation=None,
|
||||
)
|
||||
|
@ -25,6 +25,7 @@ from os import path as os_path
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
from urllib import request
|
||||
import uuid
|
||||
import yaml
|
||||
|
||||
@ -33,7 +34,6 @@ import mock
|
||||
import netaddr
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_utils import timeutils
|
||||
from six.moves.urllib import request
|
||||
from tsconfig.tsconfig import SW_VERSION
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
|
@ -55,7 +55,7 @@ class TestUploadCertStage(TestKubeRootCaUpgradeState):
|
||||
ERROR_UPLOADING_CERT
|
||||
|
||||
mock_open = mock.mock_open(read_data='test')
|
||||
with mock.patch('six.moves.builtins.open', mock_open):
|
||||
with mock.patch('builtins.open', mock_open):
|
||||
# invoke the strategy state operation on the orch thread
|
||||
self.worker.perform_state_action(self.strategy_step)
|
||||
|
||||
@ -77,7 +77,7 @@ class TestUploadCertStage(TestKubeRootCaUpgradeState):
|
||||
SUCCESS_UPLOADING_CERT
|
||||
|
||||
mock_open = mock.mock_open(read_data='test')
|
||||
with mock.patch('six.moves.builtins.open', mock_open):
|
||||
with mock.patch('builtins.open', mock_open):
|
||||
# invoke the strategy state operation on the orch thread
|
||||
self.worker.perform_state_action(self.strategy_step)
|
||||
|
||||
|
@ -17,7 +17,6 @@ import json
|
||||
from xml import etree as et
|
||||
|
||||
from oslo_log import log
|
||||
import six
|
||||
import webob
|
||||
|
||||
from dcorch.api.proxy.common.service import Middleware
|
||||
@ -91,8 +90,7 @@ class ParseError(Middleware):
|
||||
'</error_message>']
|
||||
state['headers'].append(('Content-Type', 'application/xml'))
|
||||
else:
|
||||
if six.PY3:
|
||||
app_iter = [i.decode('utf-8') for i in app_iter]
|
||||
app_iter = [i.decode('utf-8') for i in app_iter]
|
||||
# Parse explanation field from webob.exc and add it as
|
||||
# 'faulstring' to be processed by cgts-client
|
||||
fault = None
|
||||
@ -107,8 +105,7 @@ class ParseError(Middleware):
|
||||
else:
|
||||
body = [json.dumps({'error_message':
|
||||
json.dumps({'faultstring': fault})})]
|
||||
if six.PY3:
|
||||
body = [item.encode('utf-8') for item in body]
|
||||
body = [item.encode('utf-8') for item in body]
|
||||
state['headers'].append(('Content-Type', 'application/json'))
|
||||
state['headers'].append(('Content-Length', str(len(body[0]))))
|
||||
else:
|
||||
|
@ -13,15 +13,14 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import base64
|
||||
from cryptography import fernet
|
||||
import msgpack
|
||||
import psutil
|
||||
import six
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
from keystoneauth1 import exceptions as keystone_exceptions
|
||||
import msgpack
|
||||
from oslo_log import log as logging
|
||||
import psutil
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dccommon.drivers.openstack.sdk_platform import (
|
||||
@ -120,7 +119,7 @@ def get_operation_type(environ):
|
||||
|
||||
|
||||
def get_id_from_query_string(environ, id):
|
||||
import six.moves.urllib.parse as six_urlparse
|
||||
import urllib.parse as six_urlparse
|
||||
params = six_urlparse.parse_qs(environ.get('QUERY_STRING', ''))
|
||||
return params.get(id, [None])[0]
|
||||
|
||||
@ -207,7 +206,7 @@ def _unpack_token(fernet_token, fernet_keys):
|
||||
crypt = fernet.MultiFernet(fernet_instances)
|
||||
|
||||
# attempt to decode the token
|
||||
token = _restore_padding(six.binary_type(fernet_token))
|
||||
token = _restore_padding(bytes(fernet_token))
|
||||
serialized_payload = crypt.decrypt(token)
|
||||
payload = msgpack.unpackb(serialized_payload)
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
"""
|
||||
DC Orchestrator base exception handling.
|
||||
"""
|
||||
import six
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
|
||||
from dcorch.common.i18n import _
|
||||
@ -50,10 +48,6 @@ class OrchestratorException(Exception):
|
||||
# at least get the core message out if something happened
|
||||
super(OrchestratorException, self).__init__(self.message)
|
||||
|
||||
if six.PY2:
|
||||
def __unicode__(self):
|
||||
return encodeutils.exception_to_unicode(self.msg)
|
||||
|
||||
def use_fatal_exceptions(self):
|
||||
return False
|
||||
|
||||
|
@ -19,7 +19,6 @@ import uuid
|
||||
|
||||
from oslo_db import exception as oslo_db_exception
|
||||
from oslo_log import log as logging
|
||||
import six.moves
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcorch.common import consts
|
||||
@ -39,7 +38,7 @@ def get_import_path(cls):
|
||||
# Returns a iterator of tuples containing batch_size number of objects in each
|
||||
def get_batch_projects(batch_size, project_list, fillvalue=None):
|
||||
args = [iter(project_list)] * batch_size
|
||||
return six.moves.zip_longest(fillvalue=fillvalue, *args)
|
||||
return itertools.zip_longest(fillvalue=fillvalue, *args)
|
||||
|
||||
|
||||
# to do validate the quota limits
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2020-2022 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2022, 2024 Wind River Systems, Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
@ -16,16 +16,13 @@ Base class for all drivers.
|
||||
"""
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DriverBase(object):
|
||||
|
||||
six.add_metaclass(abc.ABCMeta)
|
||||
class DriverBase(object, metaclass=abc.ABCMeta):
|
||||
"""Base class for all drivers."""
|
||||
|
||||
def __init__(self, context):
|
||||
|
@ -16,12 +16,12 @@
|
||||
|
||||
import collections
|
||||
import copy
|
||||
from queue import Queue
|
||||
import re
|
||||
import threading
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from six.moves.queue import Queue
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dccommon import endpoint_cache
|
||||
|
@ -22,7 +22,6 @@ from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_service import service
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from dccommon import consts as dccommon_consts
|
||||
from dcorch.common import consts
|
||||
@ -147,7 +146,7 @@ class EngineService(service.Service):
|
||||
self._rpc_server.wait()
|
||||
LOG.info("Engine service stopped successfully")
|
||||
except Exception as ex:
|
||||
LOG.error(f"Failed to stop engine service: {six.text_type(ex)}")
|
||||
LOG.error(f"Failed to stop engine service: {str(ex)}")
|
||||
|
||||
def stop(self):
|
||||
self._stop_rpc_server()
|
||||
@ -290,7 +289,7 @@ class EngineWorkerService(service.Service):
|
||||
endpoint_type_list=endpoint_type_list)
|
||||
except Exception as ex:
|
||||
LOG.warning('Add subcloud endpoint type failed for %s: %s',
|
||||
subcloud_name, six.text_type(ex))
|
||||
subcloud_name, str(ex))
|
||||
raise
|
||||
|
||||
@request_context
|
||||
@ -302,7 +301,7 @@ class EngineWorkerService(service.Service):
|
||||
endpoint_type_list=endpoint_type_list)
|
||||
except Exception as ex:
|
||||
LOG.warning('Remove subcloud endpoint type failed for %s: %s',
|
||||
subcloud_name, six.text_type(ex))
|
||||
subcloud_name, str(ex))
|
||||
raise
|
||||
|
||||
@request_context
|
||||
@ -335,7 +334,7 @@ class EngineWorkerService(service.Service):
|
||||
self._rpc_server.wait()
|
||||
LOG.info('Engine-worker service stopped successfully')
|
||||
except Exception as ex:
|
||||
LOG.error(f"Failed to stop engine-worker service: {six.text_type(ex)}")
|
||||
LOG.error(f"Failed to stop engine-worker service: {str(ex)}")
|
||||
|
||||
def stop(self, graceful=False):
|
||||
self._stop_rpc_server()
|
||||
|
@ -14,13 +14,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import six
|
||||
|
||||
from keystoneauth1 import exceptions as keystone_exceptions
|
||||
from novaclient import client as novaclient
|
||||
from novaclient import exceptions as novaclient_exceptions
|
||||
from novaclient import utils as novaclient_utils
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
@ -215,7 +212,7 @@ class ComputeSyncThread(SyncThread):
|
||||
newflavor = self.sc_nova_client.flavors.create(
|
||||
name, ram, vcpus, disk, **kwargs)
|
||||
except novaclient_exceptions.Conflict as e:
|
||||
if "already exists" in six.text_type(e):
|
||||
if "already exists" in str(e):
|
||||
# FlavorExists or FlavorIdExists.
|
||||
LOG.info("Flavor {} already exists in subcloud"
|
||||
.format(name), extra=self.log_extra)
|
||||
|
@ -39,7 +39,6 @@ requests_toolbelt # Apache-2.0
|
||||
retrying!=1.3.0,>=1.2.3 # Apache-2.0
|
||||
routes>=2.3.1 # MIT
|
||||
sh # MIT
|
||||
six>=1.9.0 # MIT
|
||||
sqlalchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
|
||||
sqlalchemy-migrate>=0.11.0 # Apache-2.0
|
||||
webob>=1.7.1 # MIT
|
||||
|
Loading…
Reference in New Issue
Block a user