From 607368a66cba897e9add4d6c5d6132b60b54a506 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 14 Mar 2018 15:54:38 -0700 Subject: [PATCH] Introduce merge function to preserve internal state --- plugins/kernel_v2/config/trigger.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/kernel_v2/config/trigger.rb b/plugins/kernel_v2/config/trigger.rb index 62754eea7..1cbd88a25 100644 --- a/plugins/kernel_v2/config/trigger.rb +++ b/plugins/kernel_v2/config/trigger.rb @@ -102,6 +102,19 @@ module VagrantPlugins return trigger end + # Solve the mystery of disappearing state?? + def merge(other) + super.tap do |result| + other_defined_before_triggers = other.instance_variable_get(:@_before_triggers) + other_defined_after_triggers = other.instance_variable_get(:@_after_triggers) + + #overrides??? + + result.instance_variable_set(:@_before_triggers, other_defined_before_triggers) + result.instance_variable_set(:@_after_triggers, other_defined_after_triggers) + end + end + def finalize! # read through configured settings blocks and set their values # and then set up action hooks here?