From 0e632c6b9d91496d8ce209cc513806e5abaccd7a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 10 May 2022 15:28:43 +0900 Subject: [PATCH] Remove unused object storage client implementation This implementation is no longer used since Swift was removed from Undercloud. Change-Id: I41ac3b85e379cda7a8d414a2e17e4a57af15f387 --- tripleoclient/plugin.py | 28 ------------------- tripleoclient/tests/fakes.py | 14 ---------- .../tests/v1/test_overcloud_export.py | 1 - tripleoclient/v1/overcloud_deploy.py | 7 ----- 4 files changed, 50 deletions(-) diff --git a/tripleoclient/plugin.py b/tripleoclient/plugin.py index 20057ec7e..34fd4460d 100644 --- a/tripleoclient/plugin.py +++ b/tripleoclient/plugin.py @@ -18,7 +18,6 @@ import logging from osc_lib import utils -from swiftclient import client as swift_client LOG = logging.getLogger(__name__) @@ -63,7 +62,6 @@ class ClientWrapper(object): def __init__(self, instance): self._instance = instance - self._object_store = None self._local_orchestration = None def local_orchestration(self, api_port): @@ -92,29 +90,3 @@ class ClientWrapper(object): self._local_orchestration = client return self._local_orchestration - - @property - def object_store(self): - """Returns an object_store service client - - The Swift/Object client returned by python-openstack client isn't an - instance of python-swiftclient, and had far less functionality. - """ - - if self._object_store is not None: - return self._object_store - - endpoint = self._instance.get_endpoint_for_service_type( - "object-store", - region_name=self._instance._region_name, - ) - - token = self._instance.auth.get_token(self._instance.session) - - kwargs = { - 'preauthurl': endpoint, - 'preauthtoken': token - } - - self._object_store = swift_client.Connection(**kwargs) - return self._object_store diff --git a/tripleoclient/tests/fakes.py b/tripleoclient/tests/fakes.py index b6df9ea76..83a19963e 100644 --- a/tripleoclient/tests/fakes.py +++ b/tripleoclient/tests/fakes.py @@ -210,7 +210,6 @@ class FakeClientWrapper(object): def __init__(self): self._instance = mock.Mock() - self.object_store = FakeObjectClient() class FakeRunnerConfig(object): @@ -256,19 +255,6 @@ class FakeInstanceData(object): _data = {'token': {}} -class FakeObjectClient(object): - - def __init__(self): - self._instance = mock.Mock() - self.put_object = mock.Mock() - - def get_object(self, *args): - return [None, "fake"] - - def get_container(self, *args): - return [None, [{"name": "fake"}]] - - class FakePlaybookExecution(utils.TestCommand): def setUp(self, ansible_mock=True): diff --git a/tripleoclient/tests/v1/test_overcloud_export.py b/tripleoclient/tests/v1/test_overcloud_export.py index 70fc58b11..232fa28ab 100644 --- a/tripleoclient/tests/v1/test_overcloud_export.py +++ b/tripleoclient/tests/v1/test_overcloud_export.py @@ -30,7 +30,6 @@ class TestOvercloudExport(utils.TestCommand): self.app.client_manager.orchestration = mock.Mock() self.tripleoclient = mock.Mock() self.app.client_manager.tripleoclient = self.tripleoclient - self.app.client_manager.tripleoclient.object_store = mock.Mock() self.mock_open = mock.mock_open() @mock.patch('os.path.exists') diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 498d64fe1..cef838d40 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -1068,13 +1068,6 @@ class DeployOvercloud(command.Command): self._setup_clients(parsed_args) - # Swiftclient logs things like 404s at error level, which is a problem - # because we use EAFP to check for the existence of files. Turn off - # most swiftclient logging to avoid cluttering up our output with - # pointless tracebacks. - sc_logger = logging.getLogger("swiftclient") - sc_logger.setLevel(logging.CRITICAL) - _update_args_from_answers_file(parsed_args) _validate_args(parsed_args)