def __init__(self, config): """ PostgreSQL connection constructor. :param barman.config.ServerConfig config: the server configuration """ # Check that 'conninfo' option is properly set if config.conninfo is None: raise ConninfoException( "Missing 'conninfo' parameter for server '%s'" % config.name) super(PostgreSQLConnection, self).__init__(config, config.conninfo) self.configuration_files = None
def __init__(self, config): """ Streaming connection constructor :param barman.config.ServerConfig config: the server configuration """ if config.streaming_conninfo is None: raise ConninfoException( 'Missing streaming_conninfo parameter in barman configuration ' 'for server %s' % config.name ) super(StreamingConnection, self).__init__(config, config.streaming_conninfo) # Make sure we connect using the 'replication' option which # triggers streaming replication protocol communication if 'replication' not in self.conn_parameters: self.conn_parameters['replication'] = 'true' self.conninfo += ' replication=true'
def __init__(self, config): """ Streaming connection constructor :param barman.config.ServerConfig config: the server configuration """ if config.streaming_conninfo is None: raise ConninfoException( "Missing 'streaming_conninfo' parameter for server '%s'" % config.name) super(StreamingConnection, self).__init__(config, config.streaming_conninfo) # Make sure we connect using the 'replication' option which # triggers streaming replication protocol communication self.conn_parameters['replication'] = 'true' # Override 'dbname' parameter. This operation is required to mimic # the behaviour of pg_receivexlog and pg_basebackup self.conn_parameters['dbname'] = 'replication' # Rebuild the conninfo string from the modified parameter lists self.conninfo = self.encode_dsn(self.conn_parameters)
def __init__(self, config, conninfo): """ Abstract base class constructor for PostgreSQL interface. :param barman.config.ServerConfig config: the server configuration :param str conninfo: Connection information (aka DSN) """ super(PostgreSQL, self).__init__() assert conninfo self.config = config self.conninfo = conninfo self._conn = None # Build a dictionary with connection info parameters # This is mainly used to speed up search in conninfo try: self.conn_parameters = self.parse_dsn(conninfo) except (ValueError, TypeError) as e: _logger.debug(e) raise ConninfoException('Cannot connect to postgres: "%s" ' 'is not a valid connection string' % conninfo)