Drop use of six
nit: Certificate inherits from ManagedObject which already has ABCMeta as metaclass. Change-Id: I17b12980b88e306fbdc99a3e92b1fa22d8e96471 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This commit is contained in:
parent
ec760471f8
commit
3ccf918c98
|
@ -23,11 +23,8 @@ authenticating.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class Credential(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class Credential(object):
|
|
||||||
"""Base class to represent all credentials."""
|
"""Base class to represent all credentials."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
Castellan exception subclasses
|
Castellan exception subclasses
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import six.moves.urllib.parse as urlparse
|
import urllib
|
||||||
|
|
||||||
from castellan.i18n import _
|
from castellan.i18n import _
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ _FATAL_EXCEPTION_FORMAT_ERRORS = False
|
||||||
|
|
||||||
class RedirectException(Exception):
|
class RedirectException(Exception):
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
self.url = urlparse.urlparse(url)
|
self.url = urllib.parse.urlparse(url)
|
||||||
|
|
||||||
|
|
||||||
class CastellanException(Exception):
|
class CastellanException(Exception):
|
||||||
|
|
|
@ -19,13 +19,8 @@ Base Certificate Class
|
||||||
This module defines the Certificate class.
|
This module defines the Certificate class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import abc
|
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from castellan.common.objects import managed_object
|
from castellan.common.objects import managed_object
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class Certificate(managed_object.ManagedObject):
|
class Certificate(managed_object.ManagedObject):
|
||||||
"""Base class to represent all certificates."""
|
"""Base class to represent all certificates."""
|
||||||
|
|
|
@ -21,14 +21,11 @@ represent all encryption keys. The basis for this class was copied
|
||||||
from Java.
|
from Java.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from castellan.common.objects import managed_object
|
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
from castellan.common.objects import managed_object
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class Key(managed_object.ManagedObject):
|
class Key(managed_object.ManagedObject):
|
||||||
"""Base class to represent all keys."""
|
"""Base class to represent all keys."""
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,8 @@ is the base class to represent all objects managed by the key manager.
|
||||||
"""
|
"""
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class ManagedObject(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class ManagedObject(object):
|
|
||||||
"""Base class to represent all managed objects."""
|
"""Base class to represent all managed objects."""
|
||||||
|
|
||||||
def __init__(self, name=None, created=None, id=None):
|
def __init__(self, name=None, created=None, id=None):
|
||||||
|
|
|
@ -18,6 +18,7 @@ Key manager implementation for Barbican
|
||||||
"""
|
"""
|
||||||
import calendar
|
import calendar
|
||||||
import time
|
import time
|
||||||
|
import urllib
|
||||||
|
|
||||||
from cryptography.hazmat import backends
|
from cryptography.hazmat import backends
|
||||||
from cryptography.hazmat.primitives import serialization
|
from cryptography.hazmat.primitives import serialization
|
||||||
|
@ -44,7 +45,6 @@ from castellan.key_manager import key_manager
|
||||||
from barbicanclient import client as barbican_client_import
|
from barbicanclient import client as barbican_client_import
|
||||||
from barbicanclient import exceptions as barbican_exceptions
|
from barbicanclient import exceptions as barbican_exceptions
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
from six.moves import urllib
|
|
||||||
|
|
||||||
|
|
||||||
_barbican_opts = [
|
_barbican_opts = [
|
||||||
|
|
|
@ -19,11 +19,8 @@ Key manager API
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class KeyManager(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class KeyManager(object):
|
|
||||||
"""Base Key Manager Interface
|
"""Base Key Manager Interface
|
||||||
|
|
||||||
A Key Manager is responsible for managing encryption keys for volumes. A
|
A Key Manager is responsible for managing encryption keys for volumes. A
|
||||||
|
|
|
@ -31,7 +31,6 @@ from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import requests
|
import requests
|
||||||
import six
|
|
||||||
|
|
||||||
from castellan.common import exception
|
from castellan.common import exception
|
||||||
from castellan.common.objects import opaque_data as op_data
|
from castellan.common.objects import opaque_data as op_data
|
||||||
|
@ -174,11 +173,11 @@ class VaultKeyManager(key_manager.KeyManager):
|
||||||
json=params,
|
json=params,
|
||||||
verify=self._verify_server)
|
verify=self._verify_server)
|
||||||
except requests.exceptions.Timeout as ex:
|
except requests.exceptions.Timeout as ex:
|
||||||
raise exception.KeyManagerError(six.text_type(ex))
|
raise exception.KeyManagerError(str(ex))
|
||||||
except requests.exceptions.ConnectionError as ex:
|
except requests.exceptions.ConnectionError as ex:
|
||||||
raise exception.KeyManagerError(six.text_type(ex))
|
raise exception.KeyManagerError(str(ex))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise exception.KeyManagerError(six.text_type(ex))
|
raise exception.KeyManagerError(str(ex))
|
||||||
|
|
||||||
if resp.status_code in _EXCEPTIONS_BY_CODE:
|
if resp.status_code in _EXCEPTIONS_BY_CODE:
|
||||||
raise exception.KeyManagerError(resp.reason)
|
raise exception.KeyManagerError(resp.reason)
|
||||||
|
@ -200,11 +199,11 @@ class VaultKeyManager(key_manager.KeyManager):
|
||||||
try:
|
try:
|
||||||
resp = method(resource, headers=headers, json=json, verify=verify)
|
resp = method(resource, headers=headers, json=json, verify=verify)
|
||||||
except requests.exceptions.Timeout as ex:
|
except requests.exceptions.Timeout as ex:
|
||||||
raise exception.KeyManagerError(six.text_type(ex))
|
raise exception.KeyManagerError(str(ex))
|
||||||
except requests.exceptions.ConnectionError as ex:
|
except requests.exceptions.ConnectionError as ex:
|
||||||
raise exception.KeyManagerError(six.text_type(ex))
|
raise exception.KeyManagerError(str(ex))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise exception.KeyManagerError(six.text_type(ex))
|
raise exception.KeyManagerError(str(ex))
|
||||||
|
|
||||||
if resp.status_code in _EXCEPTIONS_BY_CODE:
|
if resp.status_code in _EXCEPTIONS_BY_CODE:
|
||||||
raise exception.KeyManagerError(resp.reason)
|
raise exception.KeyManagerError(resp.reason)
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
import functools
|
import functools
|
||||||
import types
|
import types
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
def construct_new_test_function(original_func, name, build_params):
|
def construct_new_test_function(original_func, name, build_params):
|
||||||
"""Builds a new test function based on parameterized data.
|
"""Builds a new test function based on parameterized data.
|
||||||
|
@ -32,10 +30,10 @@ def construct_new_test_function(original_func, name, build_params):
|
||||||
:return: A new function object
|
:return: A new function object
|
||||||
"""
|
"""
|
||||||
new_func = types.FunctionType(
|
new_func = types.FunctionType(
|
||||||
six.get_function_code(original_func),
|
original_func.__code__,
|
||||||
six.get_function_globals(original_func),
|
original_func.__globals__,
|
||||||
name=name,
|
name=name,
|
||||||
argdefs=six.get_function_defaults(original_func)
|
argdefs=original_func.__defaults__,
|
||||||
)
|
)
|
||||||
|
|
||||||
for key, val in original_func.__dict__.items():
|
for key, val in original_func.__dict__.items():
|
||||||
|
|
|
@ -58,7 +58,6 @@ PyYAML==3.12
|
||||||
requests==2.18.0
|
requests==2.18.0
|
||||||
requestsexceptions==1.2.0
|
requestsexceptions==1.2.0
|
||||||
rfc3986==0.3.1
|
rfc3986==0.3.1
|
||||||
six==1.10.0
|
|
||||||
smmap==0.9.0
|
smmap==0.9.0
|
||||||
snowballstemmer==1.2.1
|
snowballstemmer==1.2.1
|
||||||
stevedore==1.20.0
|
stevedore==1.20.0
|
||||||
|
|
Loading…
Reference in New Issue