(self, backupdir)
Initialize a new BackupLabel from existing file
Initialize a new BackupLabel from existing file
Initialize a new BackupLabel from existing file
def __init__(self, backupdir):
        """Initialize a new BackupLabel from existing file"""
        filename = os.path.join(backupdir, "backup_label")
        self.first_wal = None
        self.start_time = None
        self.label_string = None
        if not os.path.exists(filename):
            return
        for line in open(filename):
            m = re.match('^START WAL LOCATION: [^\s]+ \(file ([0-9A-Z]+)\)$', line)
            if m:
                self.first_wal = m.group(1)
            m = re.match('^START TIME:\s(.*)$', line)
            if m:
                self.start_time = m.group(1)
            m = re.match('^LABEL: (.*)$', line)
            if m:
                self.label_string = m.group(1)
def __init__ ( self , backupdir ) : filename = os . path . join ( backupdir , "backup_label" ) self . first_wal = None self . start_time = None self . label_string = None if not os . path . exists ( filename ) : return for line in open ( filename ) : m = re . match ( '^START WAL LOCATION: [^\s]+ \(file ([0-9A-Z]+)\)$' , line ) if m : self . first_wal = m . group ( 1 ) m = re . match ( '^START TIME:\s(.*)$' , line ) if m : self . start_time = m . group ( 1 ) m = re . match ( '^LABEL: (.*)$' , line ) if m : self . label_string = m . group ( 1 )