Merge "zun: remove the handling of not acceptable error"
This commit is contained in:
commit
917a5d5a20
|
@ -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:
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue