def preload(self, objs): """ See :meth:`dput.config.AbstractConfig.preload` """ configs = [] for obj in objs: configs.append( classes[obj['type']]( [obj['loc']] ) ) self.configs = configs defaults_blame = {} defaults = {} for config in configs: defaults.update(config.get_defaults()) defaults = _config_cleanup(defaults) defaults_blame.update( _blame_map(config.get_defaults(), "%s (%s)" % ( config.path, 'DEFAULT' )) ) self.defaults = defaults self.defaults_blame = defaults_blame
def get_config(self, name): """ See :meth:`dput.config.AbstractConfig.get_config` """ logger.trace("Loading entry %s" % (name)) ret = self.defaults.copy() for config in self.configs: obj = config.get_config(name) logger.trace(obj) ret.update(obj) ret = _config_cleanup(ret) logger.trace('Rewrote to:') logger.trace(obj) if logger.isEnabledFor(logging.DEBUG): logger.debug("Got configuration: %s" % (name)) for key in ret: logger.debug("\t%s: %s" % (key, ret[key])) validate_object('config', ret, 'profiles/%s' % (name)) return ret