Merge pull request #10579 from hashicorp/fix-single-plugin-loading
Fix issue when loading single plugin type `packer-provisioner-comment` built with latest SDK
This commit is contained in:
commit
2324f433f7
@ -121,7 +121,9 @@ func (c *PluginConfig) discoverExternalComponents(path string) error {
|
||||
}
|
||||
for pluginName, pluginPath := range pluginPaths {
|
||||
newPath := pluginPath // this needs to be stored in a new variable for the func below
|
||||
c.Builders.Set(pluginName, c.Client(newPath).Builder)
|
||||
c.Builders.Set(pluginName, func() (packersdk.Builder, error) {
|
||||
return c.Client(newPath).Builder()
|
||||
})
|
||||
externallyUsed = append(externallyUsed, pluginName)
|
||||
}
|
||||
if len(externallyUsed) > 0 {
|
||||
@ -136,7 +138,9 @@ func (c *PluginConfig) discoverExternalComponents(path string) error {
|
||||
}
|
||||
for pluginName, pluginPath := range pluginPaths {
|
||||
newPath := pluginPath // this needs to be stored in a new variable for the func below
|
||||
c.PostProcessors.Set(pluginName, c.Client(newPath).PostProcessor)
|
||||
c.PostProcessors.Set(pluginName, func() (packersdk.PostProcessor, error) {
|
||||
return c.Client(newPath).PostProcessor()
|
||||
})
|
||||
externallyUsed = append(externallyUsed, pluginName)
|
||||
}
|
||||
if len(externallyUsed) > 0 {
|
||||
@ -151,12 +155,15 @@ func (c *PluginConfig) discoverExternalComponents(path string) error {
|
||||
}
|
||||
for pluginName, pluginPath := range pluginPaths {
|
||||
newPath := pluginPath // this needs to be stored in a new variable for the func below
|
||||
c.Provisioners.Set(pluginName, c.Client(newPath).Provisioner)
|
||||
c.Provisioners.Set(pluginName, func() (packersdk.Provisioner, error) {
|
||||
return c.Client(newPath).Provisioner()
|
||||
})
|
||||
externallyUsed = append(externallyUsed, pluginName)
|
||||
}
|
||||
if len(externallyUsed) > 0 {
|
||||
sort.Strings(externallyUsed)
|
||||
log.Printf("using external provisioners %v", externallyUsed)
|
||||
externallyUsed = nil
|
||||
}
|
||||
|
||||
pluginPaths, err = c.discoverSingle(filepath.Join(path, "packer-datasource-*"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user