From 7e838dfae221f0eb8219374d1aeabf5bab1c813f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 1 May 2015 11:20:57 -0700 Subject: [PATCH] terraform: Graph should overrride Remove to clear lookaside --- terraform/graph.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/terraform/graph.go b/terraform/graph.go index cf931fb1f..cf5439097 100644 --- a/terraform/graph.go +++ b/terraform/graph.go @@ -54,6 +54,21 @@ func (g *Graph) Add(v dag.Vertex) dag.Vertex { return v } +// Remove is the same as dag.Graph.Remove +func (g *Graph) Remove(v dag.Vertex) dag.Vertex { + g.once.Do(g.init) + + // If this is a depend-able node, then remove the lookaside info + if dv, ok := v.(GraphNodeDependable); ok { + for _, n := range dv.DependableName() { + delete(g.dependableMap, n) + } + } + + // Call upwards to remove it from the actual graph + return g.Graph.Remove(v) +} + // ConnectDependent connects a GraphNodeDependent to all of its // GraphNodeDependables. It returns the list of dependents it was // unable to connect to.