def _setup_dao(self): dao_config.DB_URI = 'postgresql://*****:*****@%s/asterisk' % self.xivo_host db_manager.reinit() try: self.dao_engine = db_manager._dao_engine except OperationalError: logging.exception('PGSQL ERROR: could not connect to server')
def _allow_remote_access_to_pgsql(): hba_file = '/etc/postgresql/9.1/main/pg_hba.conf' postgres_conf_file = '/etc/postgresql/9.1/main/postgresql.conf' subnet_line = 'host all all {subnet} md5' for subnet in world.config.subnets: _add_line_to_remote_file(subnet_line.format(subnet=subnet), hba_file) _add_line_to_remote_file("listen_addresses = '*'", postgres_conf_file) command = ['service', 'postgresql', 'restart'] world.ssh_client_xivo.check_call(command) db_manager.reinit()