Ejemplo n.º 1
0
    def server_check(self, server_name):
        check = barman_cli('check', server_name, _ok_code=[0, 1])
        check = self.parse_output(check)
        check_dict = {}
        for key, value in check.items():
            value = 1 if value.startswith("OK") else 0
            check_dict[key] = value

        return check_dict
Ejemplo n.º 2
0
    def list_backup(self, server_name):
        backup_list = barman_cli('list-backup', server_name)
        backups_done = []
        backups_failed = []
        for backup_line in backup_list.split("\n")[:-1]:
            backup = {}
            backup['server'] = server_name
            try:
                server_name_and_ts, date, size, wal_size = \
                    backup_line.rsplit("-",3)
                backup['date'] = date.strip()
                backup['size'] = size.split(":")[1].strip()
                backup['wal_size'] = wal_size.split(":")[1].strip()
                backup['status'] = "done"
                backups_done.append(backup)
            except ValueError:
                server_name_and_ts, status = backup_line.rsplit("-", 1)
                backup['status'] = status.lower()
                backups_failed.append(backup)

        return backups_done, backups_failed
 def version(self):
     version = barman_cli('-v', _err_to_out=True).split()
     return version[0]
 def cli(*args, **kwargs):
     output = barman_cli('-f', 'json', *args, **kwargs)
     output = json.loads(str(output))
     return output
Ejemplo n.º 5
0
 def server_status(self, server_name):
     status = barman_cli('status', server_name)
     status_dict = self.parse_output(status)
     return status_dict
Ejemplo n.º 6
0
 def servers(self):
     return barman_cli('list-server', '--minimal').split()
Ejemplo n.º 7
0
 def version(cls):
     version = barman_cli('-v').split()
     return version[0]