def __init__(self, sqluri=_SQLURI, pool_size=20, pool_recycle=60, create_tables=False, no_pool=False, **kw): sqlkw = {'logging_name': 'weaveserver'} if sqluri.startswith('sqlite'): sqlkw['listeners'] = [SetTextFactory()] else: if not no_pool: sqlkw['pool_size'] = int(pool_size) sqlkw['pool_recycle'] = int(pool_recycle) driver = urlparse.urlparse(self.sqluri).scheme.lower() if "mysql" in driver: sqlkw['pool_reset_on_return'] = False if no_pool or sqluri.startswith('sqlite'): sqlkw['poolclass'] = NullPool engine = create_engine(sqluri, **sqlkw) users.metadata.bind = engine if create_tables: users.create(checkfirst=True) self.sqluri = sqluri self.logger = CLIENT_HOLDER.default_client ResetCodeManager.__init__(self, engine, create_tables=create_tables)
def __init__(self, ldapuri, sqluri, use_tls=False, bind_user='******', bind_password='******', admin_user='******', admin_password='******', users_root='ou=users,dc=mozilla', users_base_dn=None, pool_size=100, pool_recycle=3600, reset_on_return=True, single_box=False, ldap_timeout=-1, nodes_scheme='https', check_account_state=True, create_tables=False, ldap_pool_size=10, ldap_use_pool=False, connector_cls=StateConnector, check_node=False, ldap_max_lifetime=600, **kw): self.check_account_state = check_account_state self.ldapuri = ldapuri self.sqluri = sqluri self.bind_user = bind_user self.bind_password = bind_password self.admin_user = admin_user self.admin_password = admin_password self.use_tls = use_tls self.users_root = users_root self.users_base_dn = users_base_dn self.single_box = single_box self.nodes_scheme = nodes_scheme self.ldap_timeout = ldap_timeout # by default, the ldap connections use the bind user self.conn = ConnectionManager(ldapuri, bind_user, bind_password, use_tls=use_tls, timeout=ldap_timeout, size=ldap_pool_size, use_pool=ldap_use_pool, connector_cls=connector_cls, max_lifetime=ldap_max_lifetime) sqlkw = {'pool_size': int(pool_size), 'pool_recycle': int(pool_recycle), 'logging_name': 'weaveserver'} if self.sqluri is not None: driver = urlparse.urlparse(self.sqluri).scheme.lower() if "mysql" in driver: sqlkw['pool_reset_on_return'] = reset_on_return engine = create_engine(sqluri, **sqlkw) for table in tables: table.metadata.bind = engine if create_tables: table.create(checkfirst=True) else: engine = None self.check_node = check_node self.logger = CLIENT_HOLDER.default_client ResetCodeManager.__init__(self, engine, create_tables=create_tables)
def __init__(self, sqluri=_SQLURI, pool_size=20, pool_recycle=60, create_tables=True, **kw): sqlkw = {'pool_size': int(pool_size), 'pool_recycle': int(pool_recycle), 'logging_name': 'weaveserver'} if sqluri.startswith('mysql'): sqlkw['reset_on_return'] = False if sqluri.startswith('sqlite'): sqlkw['listeners'] = [SetTextFactory()] engine = create_engine(sqluri, **sqlkw) users.metadata.bind = engine if create_tables: users.create(checkfirst=True) self.sqluri = sqluri ResetCodeManager.__init__(self, engine, create_tables=create_tables)
def __init__(self, sqluri=_SQLURI, pool_size=20, pool_recycle=60, create_tables=False, no_pool=False, **kw): sqlkw = {"logging_name": "weaveserver"} if sqluri.startswith("sqlite"): sqlkw["listeners"] = [SetTextFactory()] else: if not no_pool: sqlkw["pool_size"] = int(pool_size) sqlkw["pool_recycle"] = int(pool_recycle) if sqluri.startswith("mysql"): sqlkw["reset_on_return"] = False if no_pool or sqluri.startswith("sqlite"): sqlkw["poolclass"] = NullPool engine = create_engine(sqluri, **sqlkw) users.metadata.bind = engine if create_tables: users.create(checkfirst=True) self.sqluri = sqluri ResetCodeManager.__init__(self, engine, create_tables=create_tables)
def __init__(self, sqluri=_SQLURI, pool_size=20, pool_recycle=60, create_tables=False, no_pool=False, **kw): sqlkw = {'logging_name': 'weaveserver'} if sqluri.startswith('sqlite'): sqlkw['listeners'] = [SetTextFactory()] else: if not no_pool: sqlkw['pool_size'] = int(pool_size) sqlkw['pool_recycle'] = int(pool_recycle) driver = urlparse.urlparse(self.sqluri).scheme.lower() if "mysql" in driver: sqlkw['pool_reset_on_return'] = False if no_pool or sqluri.startswith('sqlite'): sqlkw['poolclass'] = NullPool engine = create_engine(sqluri, **sqlkw) users.metadata.bind = engine if create_tables: users.create(checkfirst=True) self.sqluri = sqluri self.logger = CLIENT_HOLDER.default_client ResetCodeManager.__init__(self, engine, create_tables=create_tables)
def __init__(self, sqluri=_SQLURI, pool_size=20, pool_recycle=60, create_tables=True, **kw): sqlkw = { 'pool_size': int(pool_size), 'pool_recycle': int(pool_recycle), 'logging_name': 'weaveserver' } if sqluri.startswith('mysql'): sqlkw['reset_on_return'] = False if sqluri.startswith('sqlite'): sqlkw['listeners'] = [SetTextFactory()] engine = create_engine(sqluri, **sqlkw) users.metadata.bind = engine if create_tables: users.create(checkfirst=True) self.sqluri = sqluri ResetCodeManager.__init__(self, engine, create_tables=create_tables)
def __init__(self, ldapuri, sqluri, use_tls=False, bind_user='******', bind_password='******', admin_user='******', admin_password='******', users_root='ou=users,dc=mozilla', users_base_dn=None, pool_size=100, pool_recycle=3600, reset_on_return=True, single_box=False, ldap_timeout=-1, nodes_scheme='https', check_account_state=True, create_tables=False, ldap_pool_size=10, ldap_use_pool=False, connector_cls=StateConnector, **kw): self.check_account_state = check_account_state self.ldapuri = ldapuri self.sqluri = sqluri self.bind_user = bind_user self.bind_password = bind_password self.admin_user = admin_user self.admin_password = admin_password self.use_tls = use_tls self.users_root = users_root self.users_base_dn = users_base_dn self.single_box = single_box self.nodes_scheme = nodes_scheme self.ldap_timeout = ldap_timeout # by default, the ldap connections use the bind user self.conn = ConnectionManager(ldapuri, bind_user, bind_password, use_tls=use_tls, timeout=ldap_timeout, size=ldap_pool_size, use_pool=ldap_use_pool, connector_cls=connector_cls) sqlkw = { 'pool_size': int(pool_size), 'pool_recycle': int(pool_recycle), 'logging_name': 'weaveserver' } if self.sqluri is not None: if self.sqluri.startswith('mysql'): sqlkw['reset_on_return'] = reset_on_return engine = create_engine(sqluri, **sqlkw) for table in tables: table.metadata.bind = engine if create_tables: table.create(checkfirst=True) else: engine = None ResetCodeManager.__init__(self, engine, create_tables=create_tables)