diff options
author | Riccardo Pittau <elfosardo@gmail.com> | 2019-11-29 10:16:28 +0100 |
---|---|---|
committer | Riccardo Pittau <elfosardo@gmail.com> | 2019-12-23 09:38:25 +0100 |
commit | 78c121a5d7b6efc84d541ea4de98aa910255884e (patch) | |
tree | f60d0b75107c58f14ed99f81ef9c6831ecb2feea /ironic/common/glance_service | |
parent | 67f5a6bf5c8922a56d70daae023a004e672a88db (diff) | |
download | ironic-78c121a5d7b6efc84d541ea4de98aa910255884e.tar.gz |
Stop using six library
Since we've dropped support for Python 2.7, it's time to look at
the bright future that Python 3.x will bring and stop forcing
compatibility with older versions.
This patch removes the six library from requirements, not
looking back.
Change-Id: Ib546f16965475c32b2f8caabd560e2c7d382ac5a
Diffstat (limited to 'ironic/common/glance_service')
-rw-r--r-- | ironic/common/glance_service/image_service.py | 8 | ||||
-rw-r--r-- | ironic/common/glance_service/service_utils.py | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/ironic/common/glance_service/image_service.py b/ironic/common/glance_service/image_service.py index e3d74d38c..e1a9bbf87 100644 --- a/ironic/common/glance_service/image_service.py +++ b/ironic/common/glance_service/image_service.py @@ -14,18 +14,18 @@ # under the License. import collections +import functools import os import re import sys import time +from urllib import parse as urlparse from glanceclient import client from glanceclient import exc as glance_exc from oslo_log import log from oslo_utils import uuidutils import sendfile -import six -from six.moves.urllib import parse as urlparse from swiftclient import utils as swift_utils from ironic.common import exception @@ -56,7 +56,7 @@ def _translate_image_exception(image_id, exc_value): def check_image_service(func): """Creates a glance client if doesn't exists and calls the function.""" - @six.wraps(func) + @functools.wraps(func) def wrapper(self, *args, **kwargs): """Wrapper around methods calls. @@ -153,7 +153,7 @@ class GlanceImageService(object): exc_type, exc_value, exc_trace = sys.exc_info() new_exc = _translate_image_exception( args[0], exc_value) - six.reraise(type(new_exc), new_exc, exc_trace) + raise type(new_exc)(new_exc).with_traceback(exc_trace) @check_image_service def show(self, image_href): diff --git a/ironic/common/glance_service/service_utils.py b/ironic/common/glance_service/service_utils.py index 601895e01..d7a702285 100644 --- a/ironic/common/glance_service/service_utils.py +++ b/ironic/common/glance_service/service_utils.py @@ -19,7 +19,6 @@ import copy from oslo_serialization import jsonutils from oslo_utils import timeutils from oslo_utils import uuidutils -import six from ironic.common import exception @@ -70,7 +69,7 @@ def _convert(metadata): for attr in _CONVERT_PROPS: if attr in properties: prop = properties[attr] - if isinstance(prop, six.string_types): + if isinstance(prop, str): properties[attr] = jsonutils.loads(prop) return metadata @@ -83,7 +82,7 @@ def parse_image_id(image_href): :raises InvalidImageRef: when input image href is invalid """ - image_href = six.text_type(image_href) + image_href = str(image_href) if uuidutils.is_uuid_like(image_href): image_id = image_href elif image_href.startswith('glance://'): @@ -130,7 +129,7 @@ def is_image_active(image): def is_glance_image(image_href): - if not isinstance(image_href, six.string_types): + if not isinstance(image_href, str): return False return (image_href.startswith('glance://') or uuidutils.is_uuid_like(image_href)) |