Exemple #1
0
    def RunBuild(self):
        """Perform the build."""
        try:
            title.set_title()
            self._build_info.BeyondCorp()

            task_list = self._SetupTaskList()

            if not os.path.exists(task_list):
                root_path = FLAGS.config_root_path or '/'
                try:
                    b = builder.ConfigBuilder(self._build_info)
                    b.Start(out_file=task_list, in_path=root_path)
                except builder.ConfigBuilderError as e:
                    # TODO: Migrate to GlazierError
                    terminator.log_and_exit('Failed to build the task list',
                                            self._build_info, 4302, e)

            try:
                r = runner.ConfigRunner(self._build_info)
                r.Start(task_list=task_list)
            except runner.ConfigRunnerError as e:
                # TODO: Migrate to GlazierError
                terminator.log_and_exit('Failed to execute the task list',
                                        self._build_info, 4304, e)
        except KeyboardInterrupt:
            logging.info('KeyboardInterrupt detected, exiting.')
            sys.exit(1)
        except errors.GlazierError as e:
            terminator.log_and_exit(e.message, self._build_info, e.code,
                                    e.exception)
        except Exception as e:  # pylint: disable=broad-except
            terminator.log_and_exit('Unknown Exception', self._build_info,
                                    4000, e)
Exemple #2
0
    def RunBuild(self):
        """Perform the build."""
        try:
            title.set_title()
            self._build_info.BeyondCorp()

            task_list = self._SetupTaskList()

            if not os.path.exists(task_list):
                root_path = FLAGS.config_root_path or '/'
                try:
                    b = builder.ConfigBuilder(self._build_info)
                    b.Start(out_file=task_list, in_path=root_path)
                except builder.ConfigBuilderError as e:
                    _LogFatal(str(e), self._build_info)

            try:
                r = runner.ConfigRunner(self._build_info)
                r.Start(task_list=task_list)
            except runner.ConfigRunnerError as e:
                _LogFatal(str(e), self._build_info)
        except KeyboardInterrupt:
            _LogFatal('KeyboardInterrupt detected, exiting.',
                      self._build_info,
                      collect=False)
        except Exception:  # pylint: disable=broad-except
            _LogFatal(traceback.format_exc(), self._build_info, 4000)
Exemple #3
0
 def setUp(self):
     self.buildinfo = buildinfo.BuildInfo()
     # filesystem
     self.filesystem = fake_filesystem.FakeFilesystem()
     runner.os = fake_filesystem.FakeOsModule(self.filesystem)
     runner.open = fake_filesystem.FakeFileOpen(self.filesystem)
     runner.shutil = fake_filesystem_shutil.FakeShutilModule(
         self.filesystem)
     self.cr = runner.ConfigRunner(self.buildinfo)
     self.cr._task_list_path = '/tmp/task_list.yaml'
Exemple #4
0
 def setUp(self):
   super(ConfigRunnerTest, self).setUp()
   self.buildinfo = buildinfo.BuildInfo()
   constants.FLAGS.verify_urls = None
   # filesystem
   self.filesystem = fake_filesystem.FakeFilesystem()
   runner.os = fake_filesystem.FakeOsModule(self.filesystem)
   runner.open = fake_filesystem.FakeFileOpen(self.filesystem)
   runner.shutil = fake_filesystem_shutil.FakeShutilModule(self.filesystem)
   self.cr = runner.ConfigRunner(self.buildinfo)
   self.cr._task_list_path = '/tmp/task_list.yaml'
Exemple #5
0
  def RunBuild(self):
    """Perform the build."""
    task_list = self._SetupTaskList()

    if not os.path.exists(task_list):
      root_path = FLAGS.config_root_path or '/'
      try:
        b = builder.ConfigBuilder(self._build_info)
        b.Start(out_file=task_list, in_path=root_path)
      except builder.ConfigBuilderError as e:
        self._LogFatal(str(e))

    try:
      r = runner.ConfigRunner(self._build_info)
      r.Start(task_list=task_list)
    except runner.ConfigRunnerError as e:
      self._LogFatal(str(e))