def __init__(self, input_q): super(SyncThread, self).__init__() self.input_q = input_q self.db_instance = dbapi.get_instance() self.etcd_client = etcd.Client(host=SyncData.etcd_host, port=SyncData.etcd_port) LOG.info("SyncThread starting")
def build(cls): db = dbapi.get_instance() db_obj_list = db.get_list(cls.api_object_class.db_model) obj = cls() setattr(obj, cls.list_name, [cls.api_object_class.build(db_obj) for db_obj in db_obj_list]) return obj
def setUp(self): # TODO(enikher) # cfg.CONF.set_override("enable_authentication", False) super(DbTestCase, self).setUp() self.dbapi = dbapi.get_instance() global _DB_CACHE if not _DB_CACHE: _DB_CACHE = Database(sqla_api, sql_connection=CONF.database.connection, sqlite_db='gluon.sqlite', sqlite_clean_db='clean.sqlite') self.useFixture(_DB_CACHE)
def class_builder(base_cls, name, _db_model, attributes): new_cls = type(name, (base_cls, ), attributes) new_cls.db_model = _db_model new_cls.db = dbapi.get_instance() return new_cls