def handle(self, request, data): try: flavor_id = data["flavorid"] flavor = api.flavor_get(request, flavor_id) LOG.info('Deleting flavor with id "%s"' % flavor_id) api.flavor_delete(request, flavor_id, False) messages.info(request, "Successfully deleted flavor: %s" % flavor.name) except api_exceptions.ApiException, e: messages.error(request, "Unable to delete flavor: %s" % e.message)
def handle(self, request, data): try: flavor_id = data['flavorid'] flavor = api.flavor_get(request, flavor_id) LOG.info('Deleting flavor with id "%s"' % flavor_id) api.flavor_delete(request, flavor_id, False) messages.info(request, 'Successfully deleted flavor: %s' % flavor.name) except api_exceptions.ApiException, e: messages.error(request, 'Unable to delete flavor: %s' % e.message)
def test_flavor_delete(self): FLAVOR_ID = 6 admin_api = self.stub_admin_api(count=2) admin_api.flavors = self.mox.CreateMockAnything() admin_api.flavors.delete(FLAVOR_ID, False).AndReturn(TEST_RETURN) admin_api.flavors.delete(FLAVOR_ID, True).AndReturn(TEST_RETURN) self.mox.ReplayAll() ret_val = api.flavor_delete(self.request, FLAVOR_ID) self.assertIsNone(ret_val) ret_val = api.flavor_delete(self.request, FLAVOR_ID, purge=True) self.assertIsNone(ret_val)