def restore_server(self, localPath): pathToRestoreTo = localPath if self.gui_enabled: # Make a 'warn' object to pass to the remoteBackup class to use for error notification self.logger.debug("Creating 'warn' object.") warnToPass = self.warn("msg") # Generates the textbuffer log to be put in the textview of tab "output" logwindow = self.gtk.TextBuffer(None) self.textview.set_buffer(logwindow) else: warnToPass = None self.textview = None # Make a new RemoteBackup object with the specified parameters self.logger.debug("Creating RemoteBackup object for remote restore.") rrestore = RemoteBackup( backupHost=self.rsync["server"], user=self.rsync["username"], password=self.rsync["password"], apnumber=self.rsync["appointment_number"], remotePath=self.rsync["remote_path"], rsyncPaths=pathToRestoreTo, warnObj=warnToPass, logWindow=self.textview, progressWindow=self.progress_window, useFilter=False, isBackup=False, ) # Set up the backup running in a new thread # bup = threading.Thread(target = rrestore.runRestore) #, args=(self.progress_window,))#the comma is NOT a typo, check python tuple doc # Start the new restore thread self.logger.debug("Starting remote restore thread.") rrestore.start() if self.gui_enabled: self.progress_window.set_current_thread(rrestore)
def backup_server(self): # Build a list of paths to backup paths_to_backup = [] for path in self.rsync['paths_to_backup']: paths_to_backup.append( self.escapeQuotesInPath( path ) ) if self.gui_enabled: self.logger.debug("Creating 'warn' object.") # Make a 'warn' object to pass to the remoteBackup class to use for error notification warnToPass = self.warn("msg") #Generates the textbuffer log to be put in the textview of tab "output" logwindow = self.gtk.TextBuffer(None) self.textview.set_buffer(logwindow) else: warnToPass = None self.textview = None # Make a new RemoteBackup object with the specified parameters self.logger.debug("Creating new RemoteBackup object for backup-server job.") rbackup = RemoteBackup( backupHost=self.rsync['server'], user=self.rsync['username'], password=self.rsync['password'], apnumber=self.rsync['appointment_number'], remotePath=self.rsync['remote_path'], rsyncPaths=paths_to_backup, warnObj=warnToPass, logWindow=self.textview, progressWindow=self.progress_window, useFilter=self.rsync['use_filter'], isBackup=True ) # Start the new backup thread self.logger.debug("Starting remote backup thread.") rbackup.start() if self.gui_enabled: self.progress_window.set_current_thread(rbackup)