Example #1
0
 def _read_manifest_from_stdin(self, read_fileobj=None, chunk_size=None):
     '''
     Attempts to read xml provided to stdin and convert it to a
     downloadmanifest obj.
     :returns downloadmanifest obj.
     '''
     chunk_size = chunk_size or stages._chunk_size
     read_fileobj = read_fileobj or sys.stdin
     self.log.debug('Reading Manifest from stdin')
     fileobj = BytesIO()
     while True:
         chunk = read_fileobj.read(chunk_size)
         if not chunk:
             break
         self.log.debug('Chunk:' + str(chunk))
         fileobj.write(chunk)
     fileobj.flush()
     fileobj.seek(0)
     with fileobj:
         manifest = DownloadManifest._read_from_fileobj(
             manifest_fileobj=fileobj,
             xsd=self.args.xsd,
             key_filename=self.args.privatekey,
             sig_key_filename=self.args.cloudcert)
     return manifest
Example #2
0
 def _read_manifest_from_url(self, url=None):
     '''
     Attempts to read xml provided at the provided url and convert it to a
     downloadmanifest obj.
     :returns downloadmanifest obj.
     '''
     url = url or self.args.manifest
     self.log.debug('Reading from remote manifest from url: ' + str(url))
     return DownloadManifest.read_from_url(
         manifest_url=url,
         xsd=self.args.xsd,
         key_filename=self.args.privatekey,
         sig_key_filename=self.args.cloudcert)
Example #3
0
 def _read_manifest_from_file(self, filepath=None):
     '''
     Attempts to read xml contiained at localfile path and convert it to a
     downloadmanifest obj.
     :returns downloadmanifest obj.
     '''
     filepath = filepath or self.args.manifest
     self.log.debug('Reading from local manifest file:' + str(filepath))
     #Read manifest into BundleManifest obj...
     return DownloadManifest.read_from_file(
         filepath,
         self.args.xsd,
         key_filename=self.args.privatekey,
         sig_key_filename=self.args.cloudcert)
 def _read_manifest_from_file(self):
     self.log.debug('Reading from local manifest file')
     manifest_path = os.path.expanduser(os.path.abspath(
         self.args.manifest))
     if not os.path.exists(manifest_path):
         raise ArgumentTypeError("Manifest '{0}' does not exist"
                                 .format(self.args.manifest))
     if not os.path.isfile(manifest_path):
         raise ArgumentTypeError("Manifest '{0}' is not a file"
                                 .format(self.args.manifest))
     #Read manifest into BundleManifest obj...
     return DownloadManifest.read_from_file(
             manifest_path,
             self.args.xsd,
             key_filename=self.args.privatekey)
 def _read_manifest_from_stdin(self):
     self.log.debug('Reading Manifest from stdin')
     fileobj = BytesIO()
     while True:
         chunk = sys.stdin.read(self._chunk_size)
         if not chunk:
             break
         self.log.debug('Chunk:' + str(chunk))
         fileobj.write(chunk)
     fileobj.flush()
     fileobj.seek(0)
     with fileobj:
         manifest = DownloadManifest._read_from_fileobj(
             manifest_fileobj=fileobj,
             xsd=self.args.xsd,
             key_filename=self.args.privatekey)
     return manifest
 def _read_manifest_from_url(self):
     self.log.debug('Reading from remote manifest from url')
     return DownloadManifest.read_from_url(
             manifest_url=self.args.manifest,
             xsd=self.args.xsd,
             key_filename=self.args.privatekey)