terraform: flattenable graphNodeMissingProvisioner

This commit is contained in:
Mitchell Hashimoto 2015-05-05 12:45:28 -07:00
parent 6d4969f64c
commit d503cc2d82
1 changed files with 30 additions and 0 deletions

View File

@ -111,6 +111,14 @@ func (n *graphNodeMissingProvisioner) ProvisionerName() string {
return n.ProvisionerNameValue
}
// GraphNodeFlattenable impl.
func (n *graphNodeMissingProvisioner) Flatten(p []string) (dag.Vertex, error) {
return &graphNodeMissingProvisionerFlat{
graphNodeMissingProvisioner: n,
PathValue: p,
}, nil
}
func provisionerVertexMap(g *Graph) map[string]dag.Vertex {
m := make(map[string]dag.Vertex)
for _, v := range g.Vertices() {
@ -121,3 +129,25 @@ func provisionerVertexMap(g *Graph) map[string]dag.Vertex {
return m
}
// Same as graphNodeMissingProvisioner, but for flattening
type graphNodeMissingProvisionerFlat struct {
*graphNodeMissingProvisioner
PathValue []string
}
func (n *graphNodeMissingProvisionerFlat) Name() string {
return fmt.Sprintf(
"%s.%s", modulePrefixStr(n.PathValue), n.graphNodeMissingProvisioner.Name())
}
func (n *graphNodeMissingProvisionerFlat) Path() []string {
return n.PathValue
}
func (n *graphNodeMissingProvisionerFlat) ProvisionerName() string {
return fmt.Sprintf(
"%s.%s", modulePrefixStr(n.PathValue),
n.graphNodeMissingProvisioner.ProvisionerName())
}