Ejemplo n.º 1
0
 def validate(self):
     """
     Runs the internal validation process of the current loaded 
     configuration.
     
     :return: Returns the status code of the validator. succes = 0, error > 0
     :rtype: integer
     """
     
     validator = ConfigValidator(excepts=True)
     return validator.validate(self.main)
Ejemplo n.º 2
0
    def validate(self):
        """
        Runs the internal validation process of the current loaded 
        configuration.
        
        :return: Returns the status code of the validator. succes = 0, error > 0
        :rtype: integer
        """

        validator = ConfigValidator(excepts=True)
        return validator.validate(self.main)
Ejemplo n.º 3
0
    def validate(self, parser):
        """
        Validates repoguard configuration files.
        
        :param parser: Command line parser.
        :type parser: optparse object.
        """

        parser.add_option("-q",
                          "--quiet",
                          action="store_false",
                          dest="verbose",
                          help="be vewwy quiet (I'm hunting wabbits).",
                          default=True)
        options, args = parser.parse_args()

        if len(args) != 2:
            parser.print_help()
            return 1

        path = args[1]

        logging.basicConfig(format="%(message)s")
        logger = LoggerFactory().create('%s.tools.config' % constants.NAME)
        if options.verbose:
            level = logger.level
        else:
            level = logging.CRITICAL
        main_config = RepoGuardConfig(constants.CONFIG_PATH)
        config_validator = ConfigValidator(override=level)
        config_obj = ProjectConfig(path,
                                   template_dirs=main_config.template_dirs)
        for extend, path in config_obj.extended.iteritems():
            logger.info("Extending %s (%s)", extend, path)
        else:
            logger.info("Nothing to extend.")
        if config_validator.validate(config_obj):
            return 0
        else:
            return 1
Ejemplo n.º 4
0
 def validate(self, parser):
     """
     Validates repoguard configuration files.
     
     :param parser: Command line parser.
     :type parser: optparse object.
     """
     
     parser.add_option(
         "-q", "--quiet", action="store_false", dest="verbose",
         help="be vewwy quiet (I'm hunting wabbits).", 
         default=True
     )
     options, args = parser.parse_args()
     
     if len(args) != 2:
         parser.print_help()
         return 1
     
     path = args[1]
     
     logging.basicConfig(format="%(message)s")
     logger = LoggerFactory().create('%s.tools.config' % constants.NAME)
     if options.verbose:
         level = logger.level
     else:
         level = logging.CRITICAL
     main_config = RepoGuardConfig(constants.CONFIG_PATH)
     config_validator = ConfigValidator(override=level)
     config_obj = ProjectConfig(path, template_dirs=main_config.template_dirs)
     for extend, path in config_obj.extended.iteritems():
         logger.info("Extending %s (%s)", extend, path)
     else:
         logger.info("Nothing to extend.")
     if config_validator.validate(config_obj):
         return 0
     else:
         return 1
Ejemplo n.º 5
0
 def setup_class(cls):
     cls.validator = ConfigValidator()
     cls._init_pkg_resources_mocks()