def run(self): # This is more a check than a part of run, but because backup does # the regress in the run section, we also do the check here... if self.source.needs_regress(): # source could be read-only, so we don't try to regress it log.Log( "Previous backup to {rp} seems to have failed. " "Use rdiff-backup to 'regress' first the failed backup, " "then try again to restore".format(rp=self.source.base_dir), log.ERROR) return 1 try: if Globals.get_api_version() < 201: # compat200 restore.Restore( self.source.base_dir.new_index(self.source.restore_index), self.inc_rpath, self.target.base_dir, self.action_time) else: self._operate_restore() except OSError as exc: log.Log( "Could not complete restore due to exception '{ex}'".format( ex=exc), log.ERROR) return 1 else: log.Log("Restore successfully finished", log.INFO) return 0
def run(self): # This is more a check than a part of run, but because backup does # the regress in the run section, we also do the check here... if self.source.needs_regress(): # source could be read-only, so we don't try to regress it self.log( "Previous backup to {rp} seems to have failed. " "Use rdiff-backup to 'regress' first the failed backup, " "then try again to restore.".format( rp=self.source.base_dir.get_safepath()), self.log.ERROR) return 1 try: restore.Restore( self.source.base_dir.new_index(self.source.restore_index), self.inc_rpath, self.target.base_dir, self.action_time) except IOError as exc: self.log( "Could not complete restore due to\n{exc}".format(exc=exc), self.log.ERROR) return 1 else: self.log("Restore successfully finished", self.log.INFO) return 0