closer
This commit is contained in:
parent
23ec73b3dc
commit
7fb8da5108
4 changed files with 17 additions and 2 deletions
|
|
@ -217,3 +217,11 @@ class PluginMapping:
|
|||
f"{', '.join(cls.plugins())}"
|
||||
)
|
||||
return cls._MAPPING[plugin]
|
||||
|
||||
@classmethod
|
||||
def name_of(cls, plugin_options: OptionsValidator) -> str:
|
||||
for name, plugin_type in cls._MAPPING.items():
|
||||
if plugin_type.plugin_options_type == plugin_options.__class__:
|
||||
return name
|
||||
|
||||
raise ValueError("Plugin name does not exist")
|
||||
|
|
@ -199,10 +199,11 @@ class VariableValidation:
|
|||
for plugin_options in PluginMapping.order_options_by(
|
||||
self.plugins.zipped(), PluginOperation.MODIFY_ENTRY
|
||||
):
|
||||
plugin_key = PluginMapping.name_of(plugin_options)
|
||||
self._add_variables(PluginOperation.MODIFY_ENTRY, options=plugin_options)
|
||||
|
||||
# Validate that any formatter in the plugin options can resolve
|
||||
resolved_subscription[plugin_options.__class__.__name__] = validate_formatters(
|
||||
resolved_subscription[plugin_key] = validate_formatters(
|
||||
script=self.script,
|
||||
unresolved_variables=self.unresolved_variables,
|
||||
validator=plugin_options,
|
||||
|
|
|
|||
|
|
@ -245,3 +245,6 @@ class BaseSubscription(ABC):
|
|||
Subscription in yaml format
|
||||
"""
|
||||
return self._preset_options.yaml
|
||||
|
||||
def resolved_yaml(self):
|
||||
return self._preset_options.validated_dict
|
||||
|
|
|
|||
|
|
@ -246,7 +246,10 @@ def _validate_formatter(
|
|||
unresolvable=unresolvable,
|
||||
update=True,
|
||||
)
|
||||
return out['tmp_var'].native
|
||||
|
||||
if is_static_formatter:
|
||||
return out['tmp_var'].native
|
||||
return formatter_validator.format_string
|
||||
except RuntimeException as exc:
|
||||
if isinstance(exc, ScriptVariableNotResolved) and is_static_formatter:
|
||||
raise StringFormattingVariableNotFoundException(
|
||||
|
|
|
|||
Loading…
Reference in a new issue