Ensure we only stack when needed

We shouldn't be stacking unless we're required, so now
we run after the construction phase, and run our own construction
phase is we've changed anything.
This commit is contained in:
Mike Auty
2016-12-12 02:06:54 +00:00
parent 046d1955b5
commit eae84fd8e0
2 changed files with 15 additions and 3 deletions
@@ -6,8 +6,11 @@ vollog = logging.getLogger(__name__)
class ConstructionMagic(interfaces.automagic.AutomagicInterface):
"""Runs through the requirement tree and from the bottom up attempts to construct all TranslationLayerRequirements"""
priority = 10
"""Runs through the requirement tree and from the bottom up attempts to construct all TranslationLayerRequirements
This should run first to prevent existing configurations getting re-configured
"""
priority = 0
def __call__(self, context, config_path, requirement, optional = False):
if not requirement.validate(context, config_path):
+10 -1
View File
@@ -2,18 +2,24 @@ from urllib import parse
import volatility
from volatility.framework import interfaces
from volatility.framework.automagic import construct_layers
from volatility.framework.layers import physical
class LayerStacker(interfaces.automagic.AutomagicInterface):
"""Class that attempts to build up """
# Most important automagic, must happen first!
priority = 0
priority = 10
page_map_offset = None
location = None
def __call__(self, context, config_path, requirement):
"""Runs the automagic over the configurable"""
# Quick exit if we're not needed
if requirement.validate(context, config_path):
return
# Bow out quickly if the UI hasn't provided a single_location
if "automagic.general.single_location" not in context.config:
return
@@ -68,6 +74,9 @@ class LayerStacker(interfaces.automagic.AutomagicInterface):
path, layer = result
# splice in the new configuration into the original context
context.config.splice(path, new_context.memory[layer].build_configuration())
# Call the construction magic now we may have new things to construct
constructor = construct_layers.ConstructionMagic()
constructor(context, config_path, requirement)
def find_suitable_requirements(self, stacked_layers, requirement, context, config_path):
child_config_path = interfaces.configuration.path_join(config_path, requirement.name)