Remove long-broken convenience code from ConfigurableInterface.

In the dim and distant past, I seemingly thought it a good idea to copy
all the values out of an object's config and into local private
attributes (I guess to avoid config lookups?).  It turns out, it was
always broken because it looking at the root of the config tree, rather
than under the object's specific config settings.

This first turned up as an issue where self._meta_layer was being
overwritten by None in the vmware layer.  Removing this resolved the
issue.
This commit is contained in:
Mike Auty
2018-12-17 22:08:24 +00:00
parent cf94012956
commit 7ca5514b83
2 changed files with 2 additions and 7 deletions
@@ -114,6 +114,8 @@ class LayerStacker(interfaces.automagic.AutomagicInterface):
new_layer = stacker.stack(new_context, current_layer_name, progress_callback)
if new_layer:
new_context.memory.add_layer(new_layer)
vollog.log(constants.LOGLEVEL_VVVV,
"Stacked {} using {}".format(new_layer.name, stacker_cls.__name__))
break
except Exception as excp:
# Stacking exceptions are likely only of interest to developers, so the lowest level of logging
@@ -465,13 +465,6 @@ class ConfigurableInterface(validity.ValidityRoutines, metaclass = ABCMeta):
self._context = self._check_type(context, ContextInterface)
self._config_path = self._check_type(config_path, str)
# Store these programmatically, so we don't keep repreating the requirements
# This also allows constructed objects to populate a configuration without too much trouble
for requirement in self.get_requirements():
# Create the (private) properties using the config as backend storage
# TODO: Based on the requirement, do proper type checking
setattr(self, "_" + requirement.name, self._context.config.get(requirement.name, requirement.default))
@property
def context(self) -> 'interfaces.context.ContextInterface':
return self._context