Make the path assignment less confusing

This commit is contained in:
Tommy McNeely 2020-01-06 12:50:12 -07:00
parent 3177a5413c
commit 72112ccae2
1 changed files with 6 additions and 9 deletions

View File

@ -132,10 +132,9 @@ func (c *config) discoverExternalComponents(path string) error {
return err
}
for plugin, path := range pluginPaths {
plugin := plugin
path := path
newPath := path // this needs to be stored in a new variable for the func below
c.Builders[plugin] = func() (packer.Builder, error) {
return c.pluginClient(path).Builder()
return c.pluginClient(newPath).Builder()
}
externallyUsed = append(externallyUsed, plugin)
}
@ -150,10 +149,9 @@ func (c *config) discoverExternalComponents(path string) error {
return err
}
for plugin, path := range pluginPaths {
plugin := plugin
path := path
newPath := path // this needs to be stored in a new variable for the func below
c.PostProcessors[plugin] = func() (packer.PostProcessor, error) {
return c.pluginClient(path).PostProcessor()
return c.pluginClient(newPath).PostProcessor()
}
externallyUsed = append(externallyUsed, plugin)
}
@ -168,10 +166,9 @@ func (c *config) discoverExternalComponents(path string) error {
return err
}
for plugin, path := range pluginPaths {
plugin := plugin
path := path
newPath := path // this needs to be stored in a new variable for the func below
c.Provisioners[plugin] = func() (packer.Provisioner, error) {
return c.pluginClient(path).Provisioner()
return c.pluginClient(newPath).Provisioner()
}
externallyUsed = append(externallyUsed, plugin)
}