Пример #1
0
 def testDump(self):
     op_list = ['op1', ['op2a', 'op2b'], 'op3', {'op4a': 'op4b'}]
     files.Dump('/tmp/foo/dump.txt', op_list)
     result = files._YamlReader('/tmp/foo/dump.txt')
     self.assertEqual(result[1], ['op2a', 'op2b'])
     self.assertEqual(result[3], {'op4a': 'op4b'})
     self.assertRaises(files.Error, files.Dump, '/tmp', [])
Пример #2
0
 def _PopTask(self, tasks):
     """Remove the first event from the task list and save new list to disk."""
     tasks.pop(0)
     try:
         files.Dump(self._task_list_path, tasks, mode='w')
     except files.Error as e:
         raise ConfigRunnerError(e)
Пример #3
0
    def Start(self, out_file, in_path, in_file='build.yaml'):
        """Start parsing configuration files.

    Args:
      out_file: The location to store the compiled config data.
      in_path: The path to the root configuration file.
      in_file: The root configuration file name.
    """
        self._task_list = []
        self._Start(in_path, in_file)
        try:
            files.Dump(out_file, self._task_list, mode='a')
        except files.Error as e:
            raise ConfigBuilderError(e)
Пример #4
0
    def Start(self, out_file, in_path, in_file='build.yaml'):
        """Start parsing configuration files.

    Args:
      out_file: The location to store the compiled config data.
      in_path: The path to the root configuration file.
      in_file: The root configuration file name.
    """
        self._task_list = []
        while True:
            try:
                self._Start(in_path, in_file)
                break
            except actions.ServerChangeEvent:
                in_path = ''  # restart with a fresh path
        try:
            files.Dump(out_file, self._task_list, mode='a')
        except files.Error as e:
            raise ConfigBuilderError(e)