def instance_data_gc(): """Remove instance data for already deleted servers""" server_mgr = admin_client_set().compute.servers for instance_data in InstanceDataDAO.list_all(): try: server_mgr.get(instance_data.instance_id) except osc_exc.NotFound: InstanceDataDAO.delete(instance_data.instance_id) except Exception: current_app.logger.exception('Failed to delete data ' 'for non-existing instance %r' % instance_data.instance_id)
def test_list_all(self): l = list(InstanceDataDAO.list_all()) self.assertEquals(l, [InstanceDataDAO.get(self.instance_id)])