Make sure each GraphBuilder has a Name

Ensure that each instance of BasucGraphBuilder gets a name corresponding
to the Builder which created it. This allows us to differentiate the
graphs in the logs.
This commit is contained in:
James Bardin 2016-11-15 16:36:10 -05:00
parent bb137f4bfb
commit 3df3b99276
9 changed files with 21 additions and 8 deletions

View File

@ -30,7 +30,7 @@ type BasicGraphBuilder struct {
func (b *BasicGraphBuilder) Build(path []string) (*Graph, error) {
g := &Graph{Path: path}
debugName := "build-graph.json"
debugName := "graph.json"
if b.Name != "" {
debugName = b.Name + "-" + debugName
}
@ -125,7 +125,7 @@ func (b *BuiltinGraphBuilder) Build(path []string) (*Graph, error) {
basic := &BasicGraphBuilder{
Steps: b.Steps(path),
Validate: b.Validate,
Name: "builtin",
Name: "BuiltinGraphBuilder",
}
return basic.Build(path)

View File

@ -40,7 +40,7 @@ func (b *ApplyGraphBuilder) Build(path []string) (*Graph, error) {
return (&BasicGraphBuilder{
Steps: b.Steps(),
Validate: true,
Name: "apply",
Name: "ApplyGraphBuilder",
}).Build(path)
}

View File

@ -26,7 +26,7 @@ func (b *DestroyPlanGraphBuilder) Build(path []string) (*Graph, error) {
return (&BasicGraphBuilder{
Steps: b.Steps(),
Validate: true,
Name: "destroy",
Name: "DestroyPlanGraphBuilder",
}).Build(path)
}

View File

@ -23,6 +23,7 @@ func (b *ImportGraphBuilder) Build(path []string) (*Graph, error) {
return (&BasicGraphBuilder{
Steps: b.Steps(),
Validate: true,
Name: "ImportGraphBuilder",
}).Build(path)
}

View File

@ -38,7 +38,7 @@ func (b *PlanGraphBuilder) Build(path []string) (*Graph, error) {
return (&BasicGraphBuilder{
Steps: b.Steps(),
Validate: true,
Name: "plan",
Name: "PlanGraphBuilder",
}).Build(path)
}

View File

@ -191,7 +191,11 @@ func (n *GraphNodeConfigResource) DynamicExpand(ctx EvalContext) (*Graph, error)
steps = append(steps, &RootTransformer{})
// Build the graph
b := &BasicGraphBuilder{Steps: steps, Validate: true}
b := &BasicGraphBuilder{
Steps: steps,
Validate: true,
Name: "GraphNodeConfigResource",
}
return b.Build(ctx.Path())
}

View File

@ -74,7 +74,10 @@ func (n *NodeDestroyResource) DynamicExpand(ctx EvalContext) (*Graph, error) {
steps = append(steps, &RootTransformer{})
// Build the graph
b := &BasicGraphBuilder{Steps: steps}
b := &BasicGraphBuilder{
Steps: steps,
Name: "NodeResourceDestroy",
}
return b.Build(ctx.Path())
}

View File

@ -101,6 +101,10 @@ func (n *NodePlannableResource) DynamicExpand(ctx EvalContext) (*Graph, error) {
}
// Build the graph
b := &BasicGraphBuilder{Steps: steps, Validate: true}
b := &BasicGraphBuilder{
Steps: steps,
Validate: true,
Name: "NodePlannableResource",
}
return b.Build(ctx.Path())
}

View File

@ -142,6 +142,7 @@ func (t *CBDEdgeTransformer) depMap(
&AttachStateTransformer{State: t.State},
&ReferenceTransformer{},
},
Name: "CBDEdgeTransformer",
}).Build(nil)
if err != nil {
return nil, err