Example #1
0
    def _ProcessPathSpec(self, extraction_worker, parser_mediator, path_spec):
        """Processes a path specification.

    Args:
      extraction_worker (worker.ExtractionWorker): extraction worker.
      parser_mediator (ParserMediator): parser mediator.
      path_spec (dfvfs.PathSpec): path specification.
    """
        self._current_display_name = parser_mediator.GetDisplayNameForPathSpec(
            path_spec)

        self._CacheFileSystem(path_spec)

        excluded_find_specs = None
        if self.collection_filters_helper:
            excluded_find_specs = (
                self.collection_filters_helper.excluded_file_system_find_specs)

        try:
            extraction_worker.ProcessPathSpec(
                parser_mediator,
                path_spec,
                excluded_find_specs=excluded_find_specs)

        except KeyboardInterrupt:
            self._abort = True

            self._processing_status.aborted = True
            if self._status_update_callback:
                self._status_update_callback(self._processing_status)

        # We cannot recover from a CacheFullError and abort processing when
        # it is raised.
        except dfvfs_errors.CacheFullError:
            # TODO: signal engine of failure.
            self._abort = True
            logger.error(
                ('ABORT: detected cache full error while processing '
                 'path spec: {0:s}').format(self._current_display_name))

        # All exceptions need to be caught here to prevent the worker
        # from being killed by an uncaught exception.
        except Exception as exception:  # pylint: disable=broad-except
            parser_mediator.ProduceExtractionWarning(
                ('unable to process path specification with error: '
                 '{0!s}').format(exception),
                path_spec=path_spec)

            if getattr(self._processing_configuration, 'debug_output', False):
                self._StopStatusUpdateThread()

                logger.warning(
                    'Unhandled exception while processing path spec: {0:s}.'.
                    format(self._current_display_name))
                logger.exception(exception)

                pdb.post_mortem()

                self._StartStatusUpdateThread()
Example #2
0
  def _ProcessPathSpec(self, extraction_worker, parser_mediator, path_spec):
    """Processes a path specification.

    Args:
      extraction_worker (worker.ExtractionWorker): extraction worker.
      parser_mediator (ParserMediator): parser mediator.
      path_spec (dfvfs.PathSpec): path specification.
    """
    self._current_display_name = parser_mediator.GetDisplayNameForPathSpec(
        path_spec)

    excluded_find_specs = None
    if self.collection_filters_helper:
      excluded_find_specs = (
          self.collection_filters_helper.excluded_file_system_find_specs)

    try:
      extraction_worker.ProcessPathSpec(
          parser_mediator, path_spec, excluded_find_specs=excluded_find_specs)

    except KeyboardInterrupt:
      self._abort = True

      self._processing_status.aborted = True
      if self._status_update_callback:
        self._status_update_callback(self._processing_status)

    # We cannot recover from a CacheFullError and abort processing when
    # it is raised.
    except dfvfs_errors.CacheFullError:
      # TODO: signal engine of failure.
      self._abort = True
      logger.error((
          'ABORT: detected cache full error while processing '
          'path spec: {0:s}').format(self._current_display_name))

    # All exceptions need to be caught here to prevent the worker
    # from being killed by an uncaught exception.
    except Exception as exception:  # pylint: disable=broad-except
      parser_mediator.ProduceExtractionWarning((
          'unable to process path specification with error: '
          '{0!s}').format(exception), path_spec=path_spec)

      if getattr(self._processing_configuration, 'debug_output', False):
        logger.warning(
            'Unhandled exception while processing path spec: {0:s}.'.format(
                self._current_display_name))
        logger.exception(exception)

        pdb.post_mortem()