From 964bbd65a7090cb863e83d5f9b785dff54525063 Mon Sep 17 00:00:00 2001 From: novirium Date: Sat, 4 Jan 2020 18:27:37 +0800 Subject: [PATCH] Fix def-specify naming --- shepherd/core.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/shepherd/core.py b/shepherd/core.py index 2cf2ab4..0acd3b7 100644 --- a/shepherd/core.py +++ b/shepherd/core.py @@ -73,7 +73,7 @@ def cli(ctx, default_config_path, local_operation, only_default_layer): # 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) # scheduler.restore_jobs() @@ -117,16 +117,16 @@ def template(ctx, plugin_name, include_all, config_path, plugin_dir): plugin_dir = Path.cwd() confspec = ConfigSpecification() - if (not plugin_name) or (plugin_name=="shepherd"): + if (not plugin_name) or (plugin_name == "shepherd"): plugin_name = "shepherd" - define_core_config(confspec) + specify_core_config(confspec) else: 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: log.error(e.args[0]) sys.exit(1) - plugin_class.define_config(confspec) + plugin_class.specify_config(confspec) template_dict = confspec.get_template(include_all) 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. """ - # Create core confdef and populate it - core_confdef = ConfigSpecification() - define_core_config(core_confdef) - confman.add_confspec("shepherd", core_confdef) + # Create core confspec and populate it + core_confspec = ConfigSpecification() + specify_core_config(core_confspec) + confman.add_confspec("shepherd", core_confspec) # ====Default Local Config Layer==== # 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" -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.add_specs([ @@ -324,7 +324,7 @@ def load_config_layer_and_plugins(confman, config_source): plugin_classes = plugin.find_plugins(plugin_names, plugin_dir) for plugin_name, plugin_class in plugin_classes.items(): 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) # Validate all plugin configs