From 90bf132049d5f8896b9e3984bddf497881454ec6 Mon Sep 17 00:00:00 2001 From: "Brad P. Crochet" Date: Thu, 17 Sep 2015 10:23:56 -0400 Subject: [PATCH] Turn the orchestration client reference into a property Use a property instead of a function. This is more in line with how the clients are referenced with openstackclient, thereby making it easier to switch to the a Heat OSC plugin in the future. Change-Id: I849593e6328f3883235e9ae34232f92d6b3c0d80 --- tripleoclient/plugin.py | 1 + tripleoclient/tests/v1/overcloud_deploy/fakes.py | 1 + .../tests/v1/overcloud_deploy/test_overcloud_deploy.py | 8 ++++---- tripleoclient/v1/overcloud_deploy.py | 4 ++-- tripleoclient/v1/overcloud_node.py | 2 +- tripleoclient/v1/overcloud_update.py | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tripleoclient/plugin.py b/tripleoclient/plugin.py index 2e304db06..d000352d9 100644 --- a/tripleoclient/plugin.py +++ b/tripleoclient/plugin.py @@ -90,6 +90,7 @@ class ClientWrapper(object): return self._baremetal + @property def orchestration(self): """Returns an orchestration service client""" diff --git a/tripleoclient/tests/v1/overcloud_deploy/fakes.py b/tripleoclient/tests/v1/overcloud_deploy/fakes.py index 407774072..5efda9d48 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/fakes.py +++ b/tripleoclient/tests/v1/overcloud_deploy/fakes.py @@ -50,6 +50,7 @@ class FakeClientWrapper(object): self._orchestration = mock.Mock() self._baremetal = mock.Mock() + @property def orchestration(self): return self._orchestration diff --git a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py index af999cfb2..0c5b77bb3 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py +++ b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py @@ -104,7 +104,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_generate_overcloud_passwords.return_value = self._get_passwords() clients = self.app.client_manager - orchestration_client = clients.tripleoclient.orchestration() + orchestration_client = clients.tripleoclient.orchestration orchestration_client.stacks.get.return_value = fakes.create_tht_stack() mock_check_hypervisor_stats.return_value = { @@ -253,7 +253,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_generate_overcloud_passwords.return_value = self._get_passwords() clients = self.app.client_manager - orchestration_client = clients.tripleoclient.orchestration() + orchestration_client = clients.tripleoclient.orchestration mock_stack = fakes.create_tht_stack() orchestration_client.stacks.get.return_value = None @@ -410,7 +410,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_generate_overcloud_passwords.return_value = self._get_passwords() clients = self.app.client_manager - orchestration_client = clients.tripleoclient.orchestration() + orchestration_client = clients.tripleoclient.orchestration orchestration_client.stacks.get.return_value = fakes.create_tht_stack() mock_check_hypervisor_stats.return_value = { @@ -562,7 +562,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): autospec=True) def test_pre_heat_deploy_failed(self, mock_check_hypervisor_stats): clients = self.app.client_manager - orchestration_client = clients.tripleoclient.orchestration() + orchestration_client = clients.tripleoclient.orchestration orchestration_client.stacks.get.return_value = None mock_check_hypervisor_stats.return_value = None arglist = ['--templates'] diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index cbc8b02d9..c84f0c07a 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -285,7 +285,7 @@ class DeployOvercloud(command.Command): files = dict(list(template_files.items()) + list(env_files.items())) clients = self.app.client_manager - orchestration_client = clients.tripleoclient.orchestration() + orchestration_client = clients.tripleoclient.orchestration self.log.debug("Deploying stack: %s", stack_name) self.log.debug("Deploying template: %s", template) @@ -970,7 +970,7 @@ class DeployOvercloud(command.Command): "configuration, proceeding.") clients = self.app.client_manager - orchestration_client = clients.tripleoclient.orchestration() + orchestration_client = clients.tripleoclient.orchestration stack = self._get_stack(orchestration_client, parsed_args.stack) stack_create = stack is None diff --git a/tripleoclient/v1/overcloud_node.py b/tripleoclient/v1/overcloud_node.py index 53c150fca..e706e4e0b 100644 --- a/tripleoclient/v1/overcloud_node.py +++ b/tripleoclient/v1/overcloud_node.py @@ -53,7 +53,7 @@ class DeleteNode(command.Command): self.log.debug("take_action(%s)" % parsed_args) osc_plugin = self.app.client_manager.tripleoclient - orchestration = osc_plugin.orchestration() + orchestration = osc_plugin.orchestration scale_manager = scale.ScaleManager( heatclient=orchestration, stack_id=parsed_args.stack, diff --git a/tripleoclient/v1/overcloud_update.py b/tripleoclient/v1/overcloud_update.py index 31b951de0..7978d9a38 100644 --- a/tripleoclient/v1/overcloud_update.py +++ b/tripleoclient/v1/overcloud_update.py @@ -57,7 +57,7 @@ class UpdateOvercloud(command.Command): self.log.debug("take_action(%s)" % parsed_args) osc_plugin = self.app.client_manager.tripleoclient - orchestration = osc_plugin.orchestration() + orchestration = osc_plugin.orchestration update_manager = update.PackageUpdateManager( heatclient=orchestration, novaclient=self.app.client_manager.compute,