return # If we have successfully loaded a config, allow future whining self.whined = False try: configspec = self.defaults_to_configspec() parser = ConfigObj(configfile, configspec=configspec) validator = Validator() result = parser.validate(validator, preserve_errors=True) except Exception, ex: err('Unable to load configuration: %s' % ex) return if result != True: err('ConfigBase::load: config format is not valid') for (section_list, key, _other) in flatten_errors(parser, result): if key is not None: err('[%s]: %s is invalid' % (','.join(section_list), key)) else: err('[%s] missing' % ','.join(section_list)) else: dbg('config validated successfully') for section_name in self.sections: dbg('ConfigBase::load: Processing section: %s' % section_name) section = getattr(self, section_name) if section_name == 'profiles': for profile in parser[section_name]: dbg('ConfigBase::load: Processing profile: %s' % profile) if not section.has_key(section_name): # FIXME: Should this be outside the loop?
return # If we have successfully loaded a config, allow future whining self.whined = False try: configspec = self.defaults_to_configspec() parser = ConfigObj(configfile, configspec=configspec) validator = Validator() result = parser.validate(validator, preserve_errors=True) except Exception, ex: err('Unable to load configuration: %s' % ex) return if result != True: err('ConfigBase::load: config format is not valid') for (section_list, key, _other) in flatten_errors(parser, result): if key is not None: err('[%s]: %s is invalid' % (','.join(section_list), key)) else: err('[%s] missing' % ','.join(section_list)) else: dbg('config validated successfully') for section_name in self.sections: dbg('ConfigBase::load: Processing section: %s' % section_name) section = getattr(self, section_name) if section_name == 'profiles': for profile in parser[section_name]: dbg('ConfigBase::load: Processing profile: %s' % profile) if not section.has_key(section_name): # FIXME: Should this be outside the loop?