Fix octavia quota resource
Use correct api from octaviaclient. Looks like this is broken since the resource was addedi with [1]. [1] https://review.opendev.org/c/openstack/heat/+/705315 Change-Id: I3da9ff1be15e4f91b1693b82460fd7420373bb4f (cherry picked from commit cad151a1b43223414aa4f4a012f52b26cd158194)
This commit is contained in:
parent
60a7bf9d5a
commit
633ffc5fb6
@ -132,10 +132,10 @@ class OctaviaQuota(resource.Resource):
|
||||
|
||||
kwargs = dict((k, v) for k, v in props.items()
|
||||
if k != self.PROJECT and v is not None)
|
||||
self.client().quotas.update(props.get(self.PROJECT), **kwargs)
|
||||
self.client().quota_set(props.get(self.PROJECT), **kwargs)
|
||||
|
||||
def handle_delete(self):
|
||||
self.client().quotas.delete(self.properties[self.PROJECT])
|
||||
self.client().quota_reset(self.properties[self.PROJECT])
|
||||
|
||||
def validate(self):
|
||||
super(OctaviaQuota, self).validate()
|
||||
|
@ -57,14 +57,8 @@ class OcataQuotaTest(common.HeatTestCase):
|
||||
)
|
||||
|
||||
self.my_quota = self.stack['my_quota']
|
||||
ocata = mock.MagicMock()
|
||||
self.ocataclient = mock.MagicMock()
|
||||
self.my_quota.client = ocata
|
||||
ocata.return_value = self.ocataclient
|
||||
self.quotas = self.ocataclient.quotas
|
||||
self.quota_set = mock.MagicMock()
|
||||
self.quotas.update.return_value = self.quota_set
|
||||
self.quotas.delete.return_value = self.quota_set
|
||||
self.octaviaclient = mock.MagicMock()
|
||||
self.my_quota.client = mock.MagicMock(return_value=self.octaviaclient)
|
||||
|
||||
def _test_validate(self, resource, error_msg):
|
||||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
@ -103,7 +97,7 @@ class OcataQuotaTest(common.HeatTestCase):
|
||||
return_value='some_resource_id')
|
||||
self.my_quota.reparse()
|
||||
self.my_quota.handle_create()
|
||||
self.quotas.update.assert_called_once_with(
|
||||
self.octaviaclient.quota_set.assert_called_once_with(
|
||||
'some_project_id',
|
||||
healthmonitor=5,
|
||||
listener=5,
|
||||
@ -124,7 +118,7 @@ class OcataQuotaTest(common.HeatTestCase):
|
||||
properties=props)
|
||||
self.my_quota.reparse()
|
||||
self.my_quota.handle_update(json_snippet, tmpl_diff, prop_diff)
|
||||
self.quotas.update.assert_called_once_with(
|
||||
self.octaviaclient.quota_set.assert_called_once_with(
|
||||
'some_project_id',
|
||||
pool=1,
|
||||
member=2,
|
||||
@ -136,4 +130,5 @@ class OcataQuotaTest(common.HeatTestCase):
|
||||
def test_quota_handle_delete(self):
|
||||
self.my_quota.reparse()
|
||||
self.my_quota.handle_delete()
|
||||
self.quotas.delete.assert_called_once_with('some_project_id')
|
||||
self.octaviaclient.quota_reset.assert_called_once_with(
|
||||
'some_project_id')
|
||||
|
Loading…
x
Reference in New Issue
Block a user