def do_delete(self, context, **kwargs): '''Additional logic at the end of cluster deletion process. Set cluster status to DELETED. ''' #self.set_status(context, self.DELETED) db_api.cluster_delete(context, self.id) return True
def test_cluster_list_show_deleted(self, notify): c = self.eng.cluster_create(self.ctx, 'c-1', 0, self.profile['id']) result = self.eng.cluster_list(self.ctx) self.assertEqual(1, len(result)) self.assertEqual(c['id'], result[0]['id']) db_api.cluster_delete(self.ctx, c['id']) result = self.eng.cluster_list(self.ctx) self.assertEqual(0, len(result)) result = self.eng.cluster_list(self.ctx, show_deleted=True) self.assertEqual(1, len(result)) self.assertEqual(c['id'], result[0]['id'])
def test_cluster_find_show_deleted(self, notify): c = self.eng.cluster_create(self.ctx, 'c-1', 0, self.profile['id']) cid = c['id'] db_api.cluster_delete(self.ctx, cid) for identity in [cid, cid[:6], 'c-1']: self.assertRaises(exception.ClusterNotFound, self.eng.cluster_find, self.ctx, identity) # short id and name based finding does not support show_deleted for identity in [cid[:6], 'c-1']: self.assertRaises(exception.ClusterNotFound, self.eng.cluster_find, self.ctx, identity) # ID based finding is okay with show_deleted result = self.eng.cluster_find(self.ctx, cid, show_deleted=True) self.assertIsNotNone(result)
def delete(cls, context, obj_id): db_api.cluster_delete(context, obj_id)
def do_delete(self, context, **kwargs): """Additional logic at the end of cluster deletion process.""" db_api.cluster_delete(context, self.id) return True