+ # Set up extra defaults that will be pushed into the rest of the
+ # configs. This is a combined extrapolation of defaults based on
+ mainconfig_defaults = copy.copy(config_spec.get("DEFAULT", {}))
+ mainconfig_defaults.update(config["DEFAULT"])
+
+ plugins = config.get("plugins", {}).keys()
+ plugin_configs = {}
+
+ for plugin in plugins:
+ try:
+ plugin_config_spec_path = pkg_resources.resource_filename(
+ plugin, "config_spec.ini")
+ if not os.path.exists(plugin_config_spec_path):
+ continue
+
+ plugin_config_spec = ConfigObj(
+ plugin_config_spec_path,
+ encoding="UTF8", list_values=False, _inspec=True)
+ _setup_defaults(
+ plugin_config_spec, config_path, mainconfig_defaults)
+
+ if not "plugin_spec" in plugin_config_spec:
+ continue
+
+ plugin_configs[plugin] = plugin_config_spec["plugin_spec"]
+
+ except ImportError:
+ _log.warning(
+ "When setting up config section, could not import '%s'" %
+ plugin)
+
+ # append the plugin specific sections of the config spec
+ config_spec["plugins"] = plugin_configs
+
+ _setup_defaults(config_spec, config_path, mainconfig_defaults)
+