def _on_server(self, args): repo_dir = join(self.config_dir, 'repo') server_conf = ConfigObj(join(repo_dir, 'server.conf')) cm = CryptoManager(priv_key_location=abspath(join(repo_dir, server_conf['crypto']['priv_key_location']))) cm.load_keys() engine_params = dict(server_conf['odb'].items()) engine_params['extra'] = {} engine_params['pool_size'] = 1 query = ping_queries[engine_params['engine']] session = create_pool(cm, engine_params) session.execute(query) session.close() if self.show_output: self.logger.info('SQL ODB connection OK') kvdb_config = Bunch(dict(server_conf['kvdb'].items())) kvdb = KVDB(None, kvdb_config, cm.decrypt) kvdb.init() kvdb.conn.info() kvdb.close() if self.show_output: self.logger.info('Redis connection OK')
def ping_sql(self, engine_params, ping_query): session = create_pool(engine_params, ping_query) session.execute(ping_query) session.close() if self.show_output: self.logger.info('SQL ODB connection OK')
def ping_sql(self, cm, engine_params): query = ping_queries[engine_params['engine']] session = create_pool(cm, engine_params) session.execute(query) session.close() if self.show_output: self.logger.info('SQL ODB connection OK')
def on_server_check_sql_odb(self, cm, server_conf, repo_dir): engine_params = dict(server_conf['odb'].items()) engine_params['extra'] = {} engine_params['pool_size'] = 1 query = ping_queries[engine_params['engine']] session = create_pool(cm, engine_params) session.execute(query) session.close() if self.show_output: self.logger.info('SQL ODB connection OK')