Пример #1
0
 def setUp(self):
     self.script_type = 'test'
     self.dest_dir = '/tmp'
     self.dest = '/tmp/file'
     self.mock_logger = mock.Mock()
     self.mock_watcher = mock.Mock()
     self.retriever = script_retriever.ScriptRetriever(
         self.mock_logger, self.script_type)
Пример #2
0
    def __init__(self, script_type, debug=False):
        """Constructor.

    Args:
      script_type: string, the metadata script type to run.
      debug: bool, True if debug output should write to the console.
    """
        self.script_type = script_type
        name = '%s-script' % self.script_type
        facility = logging.handlers.SysLogHandler.LOG_DAEMON
        self.logger = logger.Logger(name=name, debug=debug, facility=facility)
        self.retriever = script_retriever.ScriptRetriever(
            self.logger, script_type)
        self.executor = script_executor.ScriptExecutor(self.logger,
                                                       script_type)
        self._RunScripts()
Пример #3
0
  def __init__(
      self, script_type, default_shell=None, run_dir=None, debug=False):
    """Constructor.

    Args:
      script_type: string, the metadata script type to run.
      default_shell: string, the default shell to execute the script.
      run_dir: string, the base directory location of the temporary directory.
      debug: bool, True if debug output should write to the console.
    """
    self.script_type = script_type
    self.default_shell = default_shell
    name = '%s-script' % self.script_type
    facility = logging.handlers.SysLogHandler.LOG_DAEMON
    self.logger = logger.Logger(name=name, debug=debug, facility=facility)
    self.retriever = script_retriever.ScriptRetriever(self.logger, script_type)
    self.executor = script_executor.ScriptExecutor(
        self.logger, script_type, default_shell=default_shell)
    self._RunScripts(run_dir=run_dir)