Пример #1
0
    def run_task_file(cls, config_file, task, **kwargs):
        config_path = get_config(config_file)

        # Check if file exists
        if config_path is None:
            if config_file:
                logger.critical("File %r not found", config_file)

            else:
                logger.critical("No suitable config file could be found")

            return False

        # Load configuration file
        try:
            logger.info('Loading config file %r', config_path)
            config = ConfigSource(BuildRunner.__environment_replacements).load(config_path)

        except ParseError, parse_error:
            logger.error('Parse error: %s', parse_error)
            logger.exception()
            if not kwargs.get('guarded', True):
                raise

            return False
Пример #2
0
    def prepare(self, argv):
        logger.debug('Preparing arguments')
        try:
            parser = optparse.OptionParser(option_list=self._option_list)
            self._opts, self._args = parser.parse_args(argv)
            return True

        except SystemExit, e:
            if e.code:
                logger.error('Option parser exited with error code %d', e.code)

            return False
Пример #3
0
    def render(self, bindings):
        buf = StringIO()

        _binding_dict = dict(bindings)
        _binding_dict['template'] = self

        context = ExternalMakoContext(buf, **_binding_dict)

        try:
            self._template.render_context(context)

        except:
            logger.error('Rendering failed')
            raise

        return buf.getvalue()
Пример #4
0
    def run_task(self, task, *args, **kwargs):
        if not self.__builders:
            logger.error("No builders found")
            return False

        for builder in self.__builders:
            try:
                if not builder.run_task(task, *args, **kwargs):
                    logger.info('Builder has no task %s' % task)

                else:
                    logger.info('Completed task %s on %s' % (task, builder))

            except Exception, error:
                logger.critical('Could not complete %s: %s', task, error)
                logger.exception()
                return False
Пример #5
0
    def run_task(self, task, *args, **kwargs):
        if not self.__builders:
            logger.error("No builders found")
            return False

        for builder in self.__builders:
            try:
                if not builder.run_task(task, *args, **kwargs):
                    logger.info('Builder has no task %s' % task)

                else:
                    logger.info('Completed task %s on %s' % (task, builder))

            except Exception, error:
                logger.critical('Could not complete %s: %s', task, error)
                logger.exception()
                return False
Пример #6
0
    def run_task_file(cls, config_file, task, **kwargs):
        config_path = get_config(config_file)

        # Check if file exists
        if config_path is None:
            if config_file:
                logger.critical("File %r not found", config_file)

            else:
                logger.critical("No suitable config file could be found")

            return False

        # Load configuration file
        try:
            logger.info('Loading config file %r', config_path)
            config = ConfigSource(
                BuildRunner.__environment_replacements).load(config_path)

        except ParseError, parse_error:
            logger.error('Parse error: %s', parse_error)
            logger.exception()
            return False