terraform: simplify internals, remove unused vars

This commit is contained in:
Mitchell Hashimoto 2014-07-06 21:53:22 -07:00
parent cc0c32d5ca
commit f1b4f7ad40
1 changed files with 5 additions and 7 deletions

View File

@ -466,7 +466,7 @@ func (c *Context) applyWalkFn(result *State) depgraph.WalkFunc {
return r.Vars(), err return r.Vars(), err
} }
return c.genericWalkFn(c.variables, cb) return c.genericWalkFn(cb)
} }
func (c *Context) planWalkFn(result *Plan, opts *PlanOpts) depgraph.WalkFunc { func (c *Context) planWalkFn(result *Plan, opts *PlanOpts) depgraph.WalkFunc {
@ -528,7 +528,7 @@ func (c *Context) planWalkFn(result *Plan, opts *PlanOpts) depgraph.WalkFunc {
return r.Vars(), nil return r.Vars(), nil
} }
return c.genericWalkFn(c.variables, cb) return c.genericWalkFn(cb)
} }
func (c *Context) refreshWalkFn(result *State) depgraph.WalkFunc { func (c *Context) refreshWalkFn(result *State) depgraph.WalkFunc {
@ -561,7 +561,7 @@ func (c *Context) refreshWalkFn(result *State) depgraph.WalkFunc {
return nil, nil return nil, nil
} }
return c.genericWalkFn(c.variables, cb) return c.genericWalkFn(cb)
} }
func (c *Context) validateWalkFn(rws *[]string, res *[]error) depgraph.WalkFunc { func (c *Context) validateWalkFn(rws *[]string, res *[]error) depgraph.WalkFunc {
@ -620,14 +620,12 @@ func (c *Context) validateWalkFn(rws *[]string, res *[]error) depgraph.WalkFunc
} }
} }
func (c *Context) genericWalkFn( func (c *Context) genericWalkFn(cb genericWalkFunc) depgraph.WalkFunc {
invars map[string]string,
cb genericWalkFunc) depgraph.WalkFunc {
var l sync.RWMutex var l sync.RWMutex
// Initialize the variables for application // Initialize the variables for application
vars := make(map[string]string) vars := make(map[string]string)
for k, v := range invars { for k, v := range c.variables {
vars[fmt.Sprintf("var.%s", k)] = v vars[fmt.Sprintf("var.%s", k)] = v
} }