Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
0
 def test_set_title_string(self, wpe, ii, sys):
     wpe.return_value = False
     ii.return_value = TEST_ID
     self.assertEqual(title.set_title(STRING),
                      '{0} [{1} - {2}]'.format(PREFIX, STRING, TEST_ID))
     sys.assert_called_with('title {0} [{1} - {2}]'.format(
         PREFIX, STRING, TEST_ID))
Exemplo n.º 4
0
    def RunBuild(self):
        """Perform the build."""
        title.set_title()

        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))

        try:
            r = runner.ConfigRunner(self._build_info)
            r.Start(task_list=task_list)
        except runner.ConfigRunnerError as e:
            _LogFatal(str(e))
Exemplo n.º 5
0
 def test_set_title_prefix(self, bt, sys):
     bt.return_value = PREFIX
     self.assertEqual(title.set_title(), PREFIX)
     sys.assert_called_with('title {}'.format(PREFIX))
Exemplo n.º 6
0
 def test_set_title_base(self, bt, sys):
     bt.return_value = '{0} [{1}]'.format(PREFIX, TEST_ID)
     self.assertEqual(title.set_title(),
                      '{0} [{1}]'.format(PREFIX, TEST_ID))
     sys.assert_called_with('title {0} [{1}]'.format(PREFIX, TEST_ID))