From 7b82f67fb849fb3033e1a816b840ec2c5346b283 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Thu, 26 Jul 2018 01:22:44 +0000 Subject: [PATCH] zun: remove the handling of not acceptable error This is for addressing outstanding comments in I4ef36a3c4a805b3e041fcb9456c297e59865485c . The handling of not acceptable error is for being compatible with legacy deployment but this requirement is an expectation so we remove it. Change-Id: I52c6dbc89ef9a00680bd9dc5e2e1ee5f2ce49f10 --- heat/engine/clients/os/zun.py | 13 +++---------- heat/tests/clients/test_zun_client.py | 14 -------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/heat/engine/clients/os/zun.py b/heat/engine/clients/os/zun.py index 51c466662c..1e1f2ca968 100644 --- a/heat/engine/clients/os/zun.py +++ b/heat/engine/clients/os/zun.py @@ -49,16 +49,9 @@ class ZunClientPlugin(client_plugin.ClientPlugin): return client def update_container(self, container_id, **prop_diff): - try: - if prop_diff: - self.client(version=self.V1_18).containers.update( - container_id, **prop_diff) - except zc_exc.NotAcceptable: - if 'name' in prop_diff: - name = prop_diff.pop('name') - self.client().containers.rename(container_id, name=name) - if prop_diff: - self.client().containers.update(container_id, **prop_diff) + if prop_diff: + self.client(version=self.V1_18).containers.update( + container_id, **prop_diff) def network_detach(self, container_id, port_id): with self.ignore_not_found: diff --git a/heat/tests/clients/test_zun_client.py b/heat/tests/clients/test_zun_client.py index 2573a095ab..ae022a2238 100644 --- a/heat/tests/clients/test_zun_client.py +++ b/heat/tests/clients/test_zun_client.py @@ -12,8 +12,6 @@ import mock -from zunclient import exceptions as zc_exc - from heat.tests import common from heat.tests import utils @@ -42,15 +40,3 @@ class ZunClientPluginTest(common.HeatTestCase): self.plugin.update_container(self.resource_id, **prop_diff) self.client.containers.update.assert_called_once_with( self.resource_id, cpu=10, memory=10, name='fake-container') - - def test_container_update_not_acceptable(self): - self.client.containers.update.side_effect = [ - zc_exc.NotAcceptable(), None] - prop_diff = {'cpu': 10, 'memory': 10, 'name': 'fake-container'} - self.plugin.update_container(self.resource_id, **prop_diff) - self.client.containers.update.assert_has_calls([ - mock.call(self.resource_id, cpu=10, memory=10, - name='fake-container'), - mock.call(self.resource_id, cpu=10, memory=10)]) - self.client.containers.rename.assert_called_once_with( - self.resource_id, name='fake-container')