def _get_target_path(self, target):
     bundle_link_url = self._bundle_model.get_bundle_metadata(
         [target.bundle_uuid], "link_url").get(target.bundle_uuid)
     if bundle_link_url:
         bundle_link_url = self._transform_link_path(bundle_link_url)
     bundle_path = bundle_link_url or self._bundle_store.get_bundle_location(
         target.bundle_uuid)
     try:
         path = download_util.get_target_path(bundle_path, target)
         return path
     except download_util.PathException as e:
         raise UsageError(str(e))
 def _get_target_path(self, target):
     bundle_link_url = self._bundle_model.get_bundle_metadata(
         [target.bundle_uuid], "link_url").get(target.bundle_uuid)
     if bundle_link_url:
         # If bundle_link_url points to a locally mounted volume, call _transform_link_path
         # to get the actual path where it can be accessed.
         bundle_link_url = self._transform_link_path(bundle_link_url)
     bundle_path = bundle_link_url or self._bundle_store.get_bundle_location(
         target.bundle_uuid)
     try:
         path = download_util.get_target_path(bundle_path, target)
         return path
     except download_util.PathException as e:
         raise UsageError(str(e))
Example #3
0
 def _threaded_read(self, run_state, path, stream_fn, reply_fn):
     """
     Given a run state, a path, a stream function and a reply function,
         - Computes the real filesystem path to the path in the bundle
         - In case of error, invokes reply_fn with an http error
         - Otherwise starts a thread calling stream_fn on the computed final path
     """
     try:
         final_path = get_target_path(run_state.bundle_path,
                                      run_state.bundle['uuid'], path)
     except PathException as e:
         reply_fn((http.client.NOT_FOUND, str(e)), None, None)
     read_thread = threading.Thread(target=stream_fn, args=[final_path])
     read_thread.start()
     self.read_threads.append(read_thread)
Example #4
0
 def _get_target_path(self, target):
     bundle_path = self._bundle_store.get_bundle_location(target.bundle_uuid)
     try:
         return download_util.get_target_path(bundle_path, target)
     except download_util.PathException as e:
         raise UsageError(str(e))