Exemple #1
0
    def test_rsync_backup_executor_init(self):
        """
        Test the construction of a RsyncBackupExecutor
        """

        # Test
        server = build_mocked_server()
        backup_manager = Mock(server=server, config=server.config)
        assert RsyncBackupExecutor(backup_manager)

        # Test exception for the missing ssh_command
        with pytest.raises(SshCommandException):
            server.config.ssh_command = None
            RsyncBackupExecutor(server)
Exemple #2
0
 def __init__(self, server):
     """
     Constructor
     """
     super(BackupManager, self).__init__()
     self.server = server
     self.config = server.config
     self._backup_cache = None
     self.compression_manager = CompressionManager(self.config, server.path)
     self.executor = None
     try:
         if server.passive_node:
             self.executor = PassiveBackupExecutor(self)
         elif self.config.backup_method == "postgres":
             self.executor = PostgresBackupExecutor(self)
         elif self.config.backup_method == "local-rsync":
             self.executor = RsyncBackupExecutor(self, local_mode=True)
         else:
             self.executor = RsyncBackupExecutor(self)
     except SshCommandException as e:
         self.config.disabled = True
         self.config.msg_list.append(force_str(e).strip())