From 07aa6b7c9a673f7ad27540e43ea678d4256f86d4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 1 Feb 2024 21:05:04 +0900 Subject: [PATCH] Remove six from FusionStorage driver Change-Id: Id231e4cab1d9994248375cb86f6fd06db9d777c5 --- .../unit/volume/drivers/fusionstorage/test_fs_conf.py | 2 +- cinder/volume/drivers/fusionstorage/fs_client.py | 3 +-- cinder/volume/drivers/fusionstorage/fs_conf.py | 9 ++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/fusionstorage/test_fs_conf.py b/cinder/tests/unit/volume/drivers/fusionstorage/test_fs_conf.py index fdd2a24b009..bc18b02a9ec 100644 --- a/cinder/tests/unit/volume/drivers/fusionstorage/test_fs_conf.py +++ b/cinder/tests/unit/volume/drivers/fusionstorage/test_fs_conf.py @@ -12,13 +12,13 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import configparser import os import shutil import tempfile from unittest import mock import ddt -from six.moves import configparser from cinder.tests.unit import test from cinder.volume.drivers.fusionstorage import fs_conf diff --git a/cinder/volume/drivers/fusionstorage/fs_client.py b/cinder/volume/drivers/fusionstorage/fs_client.py index d4ddaacd007..850efdba713 100644 --- a/cinder/volume/drivers/fusionstorage/fs_client.py +++ b/cinder/volume/drivers/fusionstorage/fs_client.py @@ -17,7 +17,6 @@ import json from oslo_log import log as logging import requests -import six from cinder import exception from cinder.i18n import _ @@ -78,7 +77,7 @@ class RestCommon(object): result.raise_for_status() except requests.HTTPError as exc: return {"error": {"code": exc.response.status_code, - "description": six.text_type(exc)}} + "description": str(exc)}} if not filter_flag: LOG.info(''' diff --git a/cinder/volume/drivers/fusionstorage/fs_conf.py b/cinder/volume/drivers/fusionstorage/fs_conf.py index 378fff57b5d..1d02b0bc74e 100644 --- a/cinder/volume/drivers/fusionstorage/fs_conf.py +++ b/cinder/volume/drivers/fusionstorage/fs_conf.py @@ -14,11 +14,10 @@ # under the License. import base64 +import configparser import os from oslo_log import log as logging -import six -from six.moves import configparser from cinder import exception from cinder.i18n import _ @@ -56,12 +55,12 @@ class FusionStorageConf(object): need_encode = False if name_node is not None and not name_node.startswith('!&&&'): - encoded = base64.b64encode(six.b(name_node)).decode() + encoded = base64.b64encode(name_node.encode('latin-1')).decode() name_node = '!&&&' + encoded need_encode = True if pwd_node is not None and not pwd_node.startswith('!&&&'): - encoded = base64.b64encode(six.b(pwd_node)).decode() + encoded = base64.b64encode(pwd_node.encode('latin-1')).decode() pwd_node = '!&&&' + encoded need_encode = True @@ -96,7 +95,7 @@ class FusionStorageConf(object): setattr(self.configuration, 'san_address', address) def _decode_text(self, text): - return (base64.b64decode(six.b(text[4:])).decode() if + return (base64.b64decode(text[4:].encode('latin-1')).decode() if text.startswith('!&&&') else text) def _san_user(self):