diff --git a/volatility/framework/interfaces/configuration.py b/volatility/framework/interfaces/configuration.py index 18d4905fb..5cbad9e5b 100644 --- a/volatility/framework/interfaces/configuration.py +++ b/volatility/framework/interfaces/configuration.py @@ -35,7 +35,7 @@ vollog = logging.getLogger(__name__) BasicTypes = (int, bool, bytes, str) SimpleTypes = Union[int, bool, bytes, str] -ConfigSimpleType = Union[SimpleTypes, List[SimpleTypes]] +ConfigSimpleType = Optional[Union[SimpleTypes, List[SimpleTypes]]] def path_join(*args) -> str: @@ -184,6 +184,8 @@ class HierarchicalDict(collections.abc.Mapping): raise TypeError("Configuration list types cannot contain list types") new_list.append(element_value) return new_list + elif value is None: + return None else: raise TypeError("Invalid type stored in configuration") @@ -296,7 +298,7 @@ class RequirementInterface(metaclass = ABCMeta): def __init__(self, name: str, description: str = None, - default: Optional[ConfigSimpleType] = None, + default: ConfigSimpleType = None, optional: bool = False) -> None: """ @@ -334,7 +336,7 @@ class RequirementInterface(metaclass = ABCMeta): return self._description @property - def default(self) -> Optional[ConfigSimpleType]: + def default(self) -> ConfigSimpleType: """Returns the default value if one is set.""" return self._default diff --git a/volatility/framework/interfaces/plugins.py b/volatility/framework/interfaces/plugins.py index c1b833d45..ff7dcb5f3 100644 --- a/volatility/framework/interfaces/plugins.py +++ b/volatility/framework/interfaces/plugins.py @@ -102,7 +102,7 @@ class PluginInterface(interfaces.configuration.ConfigurableInterface, raise exceptions.PluginRequirementException("The plugin configuration failed to validate") # Populate any optional defaults for requirement in self.get_requirements(): - if requirement.name not in self.config and requirement.default is not None: + if requirement.name not in self.config: self.config[requirement.name] = requirement.default self._file_consumer = None # type: Optional[FileConsumerInterface]