Exemplo n.º 1
0
    def _get_manifest_filesystem(self):
        data = None
        with jms_utils.paths.ChDir(self.data_dir):
            if not os.path.exists(self.version_file):
                log.warning('No version file on file system')
                return data
            else:
                log.info('Found version file on file system')
                try:
                    with open(self.version_file, 'rb') as f:
                        data = f.read()
                    log.info('Loaded version file from file system')
                except Exception as err:
                    # Whatever the error data is already set to None
                    log.error('Failed to load version file from file '
                              'system')
                    log.debug(str(err), exc_info=True)
                # In case we don't have any data to pass
                # Catch the error here and just return None
                try:
                    decompressed_data = gzip_decompress(data)
                except Exception as err:
                    decompressed_data = None

                return decompressed_data
Exemplo n.º 2
0
    def _get_manifest_filesystem(self):
        data = None
        with jms_utils.paths.ChDir(self.data_dir):
            if not os.path.exists(self.version_file):
                log.warning('No version file on file system')
                return data
            else:
                log.info('Found version file on file system')
                try:
                    with open(self.version_file, 'rb') as f:
                        data = f.read()
                    log.info('Loaded version file from file system')
                except Exception as err:
                    # Whatever the error data is already set to None
                    log.error('Failed to load version file from file '
                              'system')
                    log.debug(str(err), exc_info=True)
                # In case we don't have any data to pass
                # Catch the error here and just return None
                try:
                    decompressed_data = gzip_decompress(data)
                except Exception as err:
                    decompressed_data = None

                return decompressed_data
Exemplo n.º 3
0
 def _download_manifest(self):
     log.info('Downloading online version file')
     try:
         fd = FileDownloader(self.version_file, self.update_urls,
                             verify=self.verify)
         data = fd.download_verify_return()
         try:
             decompressed_data = gzip_decompress(data)
         except IOError:
             log.error('Failed to decompress gzip file')
             # Will be caught down below. Just logging the error
             raise
         log.info('Version file download successful')
         # Writing version file to application data directory
         self._write_manifest_2_filesystem(decompressed_data)
         return decompressed_data
     except Exception as err:
         log.error('Version file download failed')
         log.debug(str(err), exc_info=True)
         return None
Exemplo n.º 4
0
 def _download_manifest(self):
     log.info('Downloading online version file')
     try:
         fd = FileDownloader(self.version_file,
                             self.update_urls,
                             verify=self.verify)
         data = fd.download_verify_return()
         try:
             decompressed_data = gzip_decompress(data)
         except IOError:
             log.error('Failed to decompress gzip file')
             # Will be caught down below. Just logging the error
             raise
         log.info('Version file download successful')
         # Writing version file to application data directory
         self._write_manifest_2_filesystem(decompressed_data)
         return decompressed_data
     except Exception as err:
         log.error('Version file download failed')
         log.debug(str(err), exc_info=True)
         return None