Fix def-specify naming

master
Tom Wilson 6 years ago
parent 080fb20b01
commit 964bbd65a7

@ -73,7 +73,7 @@ def cli(ctx, default_config_path, local_operation, only_default_layer):
# control.init_control(core_config, plugin_configs) # control.init_control(core_config, plugin_configs)
# scheduler.init_scheduler(core_config) scheduler.init_scheduler(core_config)
plugin.init_plugins(plugin_classes, plugin_configs, core_config) plugin.init_plugins(plugin_classes, plugin_configs, core_config)
# scheduler.restore_jobs() # scheduler.restore_jobs()
@ -119,14 +119,14 @@ def template(ctx, plugin_name, include_all, config_path, plugin_dir):
confspec = ConfigSpecification() confspec = ConfigSpecification()
if (not plugin_name) or (plugin_name == "shepherd"): if (not plugin_name) or (plugin_name == "shepherd"):
plugin_name = "shepherd" plugin_name = "shepherd"
define_core_config(confspec) specify_core_config(confspec)
else: else:
try: try:
plugin_class = plugin.find_plugins([plugin_name], plugin_dir)[0] plugin_class = plugin.find_plugins([plugin_name], plugin_dir)[plugin_name]
except plugin.PluginLoadError as e: except plugin.PluginLoadError as e:
log.error(e.args[0]) log.error(e.args[0])
sys.exit(1) sys.exit(1)
plugin_class.define_config(confspec) plugin_class.specify_config(confspec)
template_dict = confspec.get_template(include_all) template_dict = confspec.get_template(include_all)
template_toml = toml.dumps({plugin_name: template_dict}) template_toml = toml.dumps({plugin_name: template_dict})
@ -175,10 +175,10 @@ def compile_config_and_get_plugins(confman, default_config_path, layers_disabled
ones where necessary. Also gathers needed plugin classes in the process. ones where necessary. Also gathers needed plugin classes in the process.
""" """
# Create core confdef and populate it # Create core confspec and populate it
core_confdef = ConfigSpecification() core_confspec = ConfigSpecification()
define_core_config(core_confdef) specify_core_config(core_confspec)
confman.add_confspec("shepherd", core_confdef) confman.add_confspec("shepherd", core_confspec)
# ====Default Local Config Layer==== # ====Default Local Config Layer====
# This must validate to continue. # This must validate to continue.
@ -262,9 +262,9 @@ def compile_config_and_get_plugins(confman, default_config_path, layers_disabled
# Relative pathnames here are all relative to "root_dir" # Relative pathnames here are all relative to "root_dir"
def define_core_config(confspec): def specify_core_config(confspec):
""" """
Defines the config definition by populating the ConfigSpecification passed in Defines the config specification by populating the ConfigSpecification passed in
``confspec`` - the same pattern plugins use ``confspec`` - the same pattern plugins use
""" """
confspec.add_specs([ confspec.add_specs([
@ -324,7 +324,7 @@ def load_config_layer_and_plugins(confman, config_source):
plugin_classes = plugin.find_plugins(plugin_names, plugin_dir) plugin_classes = plugin.find_plugins(plugin_names, plugin_dir)
for plugin_name, plugin_class in plugin_classes.items(): for plugin_name, plugin_class in plugin_classes.items():
new_conf_spec = ConfigSpecification() new_conf_spec = ConfigSpecification()
plugin_class.define_config(new_conf_spec) plugin_class.specify_config(new_conf_spec)
confman.add_confspec(plugin_name, new_conf_spec) confman.add_confspec(plugin_name, new_conf_spec)
# Validate all plugin configs # Validate all plugin configs

Loading…
Cancel
Save