Additional "Unify Manager._update behaviour" cleanup
Make _update always return an instance of self.resource_class. This is in preparation for fixing bug 1145768 by reverting the API changes made in the original "Unify Manager._update behaviour" change. This is to avoid needing to revert some of the cleanup that was made in that change. Change-Id: I842bda40a0dc168689a7dd8b88433c3cebef5839
This commit is contained in:
parent
8ac304f7f5
commit
f73df49e4f
@ -156,10 +156,11 @@ class Manager(utils.HookableMixin):
|
||||
def _update(self, url, body, response_key=None, **kwargs):
|
||||
self.run_hooks('modify_body_for_update', body, **kwargs)
|
||||
_resp, body = self.api.client.put(url, body=body)
|
||||
if response_key:
|
||||
return self.resource_class(self, body[response_key])
|
||||
else:
|
||||
return body
|
||||
if body:
|
||||
if response_key:
|
||||
return self.resource_class(self, body[response_key])
|
||||
else:
|
||||
return self.resource_class(self, body)
|
||||
|
||||
|
||||
class ManagerWithFind(Manager):
|
||||
|
@ -61,4 +61,4 @@ class FloatingIPsBulkTest(utils.TestCase):
|
||||
fl = cs.floating_ips_bulk.delete('192.168.1.0/30')
|
||||
body = {'ip_range': '192.168.1.0/30'}
|
||||
cs.assert_called('PUT', '/os-floating-ips-bulk/delete', body)
|
||||
self.assertEqual(fl['floating_ips_bulk_delete'], body['ip_range'])
|
||||
self.assertEqual(fl.floating_ips_bulk_delete, body['ip_range'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user