Exemplo n.º 1
0
    def manual(self, job, path):
        """
        Apply manual update of file `path`.
        """
        dest_extracted = os.path.join(os.path.dirname(path), '.update')
        try:
            try:
                job.set_progress(30, 'Extracting file')
                ExtractFrozenUpdate(path, dest_extracted, verbose=True)
                job.set_progress(50, 'Applying update')
                ApplyUpdate(dest_extracted)
            except Exception as e:
                self.logger.debug('Applying manual update failed',
                                  exc_info=True)
                raise CallError(str(e), errno.EFAULT)

            job.set_progress(95, 'Cleaning up')
        finally:
            if os.path.exists(path):
                os.unlink(path)

            if os.path.exists(dest_extracted):
                shutil.rmtree(dest_extracted, ignore_errors=True)

        if path.startswith(UPLOAD_LOCATION):
            self.middleware.call_sync('update.destroy_upload_location')
Exemplo n.º 2
0
 def do_update():
     try:
         job.set_progress(30, 'Extracting uploaded file')
         ExtractFrozenUpdate(destfile, dest_extracted, verbose=True)
         job.set_progress(50, 'Applying update')
         ApplyUpdate(dest_extracted)
     except Exception as e:
         raise CallError(str(e))
Exemplo n.º 3
0
 def do_update():
     try:
         job.set_progress(30, 'Extracting uploaded file')
         ExtractFrozenUpdate(destfile, dest_extracted, verbose=True)
         job.set_progress(50, 'Applying update')
         if ApplyUpdate(dest_extracted) is None:
             raise ValueError(
                 'Uploaded file is not a manual update file')
     except Exception as e:
         raise CallError(str(e))