def kill(self): """Destroy the service object in the datastore.""" self.stop() try: db.service_destroy(context.get_admin_context(), self.service_id) except exception.NotFound: LOG.warning('Service killed that has no database entry')
def kill(self): """Destroy the service object in the datastore.""" self.stop() try: db.service_destroy(context.get_admin_context(), self.service_id) except exception.NotFound: LOG.warning(_LW('Service killed that has no database entry'))
def test_service_disabled_on_create_based_on_flag(self): self.flags(enable_new_services=False) host = 'foo' binary = 'karbor-fake' app = service.Service.create(host=host, binary=binary) app.start() app.stop() ref = db.service_get(context.get_admin_context(), app.service_id) db.service_destroy(context.get_admin_context(), app.service_id) self.assertTrue(ref['disabled'])
def test_service_destroy(self): service_ref = db.service_create(self.ctxt, {'host': 'hosttest2', 'binary': 'binarytest2', 'topic': 'topictest2', 'report_count': 0}) service_id = service_ref['id'] db.service_destroy(self.ctxt, service_id) self.assertRaises(exception.ServiceNotFound, db.service_get, self.ctxt, service_id)
def test_service_destroy(self): service_ref = db.service_create( self.ctxt, { 'host': 'hosttest2', 'binary': 'binarytest2', 'topic': 'topictest2', 'report_count': 0 }) service_id = service_ref['id'] db.service_destroy(self.ctxt, service_id) self.assertRaises(exception.ServiceNotFound, db.service_get, self.ctxt, service_id)
def destroy(self): with self.obj_as_admin(): db.service_destroy(self._context, self.id)