Change plugin runner to use a base_config_path.

This commit is contained in:
Mike Auty
2018-09-24 00:45:36 +01:00
parent e5024420c8
commit 99ba8bfb3f
3 changed files with 10 additions and 6 deletions
+3 -2
View File
@@ -158,7 +158,8 @@ class CommandLine(interfaces.plugins.FileConsumerInterface):
vollog.log(constants.LOGLEVEL_VVV, "Cache directory used: {}".format(constants.CACHE_PATH))
plugin = plugin_list[args.plugin]
plugin_config_path = interfaces.configuration.path_join('plugins', plugin.__name__)
base_config_path = "plugins"
plugin_config_path = interfaces.configuration.path_join(base_config_path, plugin.__name__)
# Special case the -f argument because people use is so frequently
# It has to go here so it can be overridden by single-location if it's defined
@@ -203,7 +204,7 @@ class CommandLine(interfaces.plugins.FileConsumerInterface):
constructed = plugins.run_plugin(ctx,
automagics,
plugin,
plugin_config_path,
base_config_path,
progress_callback,
self)
+3 -2
View File
@@ -133,7 +133,8 @@ class VolShell(cli.CommandLine):
if args.windows:
plugin = windows.Volshell
plugin_config_path = interfaces.configuration.path_join('plugins', plugin.__name__)
base_config_path = "plugins"
plugin_config_path = interfaces.configuration.path_join(base_config_path, plugin.__name__)
# Special case the -f argument because people use is so frequently
# It has to go here so it can be overridden by single-location if it's defined
@@ -178,7 +179,7 @@ class VolShell(cli.CommandLine):
constructed = plugins.run_plugin(ctx,
automagics,
plugin,
plugin_config_path,
base_config_path,
progress_callback,
self)
+4 -2
View File
@@ -9,7 +9,7 @@ vollog = logging.getLogger(__name__)
def run_plugin(context: interfaces.context.ContextInterface,
automagics: typing.List[interfaces.automagic.AutomagicInterface],
plugin: typing.Type[interfaces.plugins.PluginInterface],
plugin_config_path: str,
base_config_path: str,
progress_callback: interfaces.layers.ProgressValue,
file_consumer: interfaces.plugins.FileConsumerInterface) -> interfaces.plugins.PluginInterface:
"""Constructs a plugin object based on the parameters
@@ -27,7 +27,9 @@ def run_plugin(context: interfaces.context.ContextInterface,
Returns:
The constructed plugin object
"""
errors = automagic.run(automagics, context, plugin, "plugins", progress_callback = progress_callback)
errors = automagic.run(automagics, context, plugin, base_config_path, progress_callback = progress_callback)
# Plugins always get their configuration stored under their plugin name
plugin_config_path = interfaces.configuration.path_join(base_config_path, plugin.__name__)
# Check all the requirements and/or go back to the automagic step
unsatisfied = plugin.unsatisfied(context, plugin_config_path)