def get_basebackup(self, arg): """Download a basebackup from an object store""" if not arg.tablespace_dir: tablespace_mapping = {} else: try: tablespace_mapping = dict(v.split("=", 1) for v in arg.tablespace_dir) except ValueError: raise RestoreError("Invalid tablespace mapping {!r}".format(arg.tablespace_dir)) self.config = config.read_json_config_file(arg.config, check_commands=False) site = config.get_site_from_config(self.config, arg.site) try: self.storage = self._get_object_storage(site, arg.target_dir) self._get_basebackup( pgdata=arg.target_dir, basebackup=arg.basebackup, site=site, primary_conninfo=arg.primary_conninfo, recovery_end_command=arg.recovery_end_command, recovery_target_action=arg.recovery_target_action, recovery_target_name=arg.recovery_target_name, recovery_target_time=arg.recovery_target_time, recovery_target_xid=arg.recovery_target_xid, restore_to_master=arg.restore_to_master, overwrite=arg.overwrite, tablespace_mapping=tablespace_mapping, ) except RestoreError: raise except Exception as ex: if self.log_tracebacks: self.log.exception("Unexpected _get_basebackup failure") raise RestoreError("{}: {}".format(ex.__class__.__name__, ex))
def list_basebackups(self, arg): """List basebackups from an object store""" self.config = config.read_json_config_file(arg.config, check_commands=False) site = config.get_site_from_config(self.config, arg.site) self.storage = self._get_object_storage(site, pgdata=None) self.storage.show_basebackup_list(verbose=arg.verbose)
def set_config(self, config_file, site): self.config = config.read_json_config_file(config_file, check_commands=False) self.site = config.get_site_from_config(self.config, site) self.backup_site = self.config["backup_sites"][self.site] storage_config = common.get_object_storage_config( self.config, self.site) self.storage = get_transfer(storage_config)
def get_basebackup(self, arg): """Download a basebackup from an object store""" self.config = config.read_json_config_file(arg.config, check_commands=False) site = config.get_site_from_config(self.config, arg.site) try: self.storage = self._get_object_storage(site, arg.target_dir) self._get_basebackup( arg.target_dir, arg.basebackup, site, primary_conninfo=arg.primary_conninfo, recovery_end_command=arg.recovery_end_command, recovery_target_action=arg.recovery_target_action, recovery_target_name=arg.recovery_target_name, recovery_target_time=arg.recovery_target_time, recovery_target_xid=arg.recovery_target_xid, restore_to_master=arg.restore_to_master, overwrite=arg.overwrite) except RestoreError: raise except Exception as ex: raise RestoreError("{}: {}".format(ex.__class__.__name__, ex))