From b7aa7d68b5f0e03ba087db877495241e0bc26e2c Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Mon, 12 Feb 2018 10:38:20 +0000 Subject: [PATCH] config/plugin_cache: Add specific error for `global` and `config` entries Add a special error for finding `global` or `config`` entries in configuration to provide a more helpful error message. --- wa/framework/configuration/plugin_cache.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wa/framework/configuration/plugin_cache.py b/wa/framework/configuration/plugin_cache.py index 3ccef6bb..19691941 100644 --- a/wa/framework/configuration/plugin_cache.py +++ b/wa/framework/configuration/plugin_cache.py @@ -22,7 +22,7 @@ from wa.framework import pluginloader from wa.framework.configuration.core import get_config_point_map from wa.framework.exception import ConfigError from wa.framework.target.descriptor import list_target_descriptions -from wa.utils.types import obj_dict +from wa.utils.types import obj_dict, caseless_string GENERIC_CONFIGS = ["device_config", "workload_parameters", "boot_parameters", "runtime_parameters"] @@ -79,6 +79,11 @@ class PluginCache(object): msg = "Source '{}' has not been added to the plugin cache." raise RuntimeError(msg.format(source)) + if caseless_string(plugin_name) in ['global', 'config']: + msg = '"{}" entry specified inside config/global section; If this is ' \ + 'defined in a config file, move the entry content into the top level' + raise ConfigError(msg.format((plugin_name))) + if (not self.loader.has_plugin(plugin_name) and plugin_name not in self.targets and plugin_name not in GENERIC_CONFIGS):