Fix issue when loading datasource single plugin type (#10589)

This commit is contained in:
Sylvia Moss 2021-02-08 13:58:35 +01:00 committed by GitHub
parent d53488db68
commit f616955ebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -172,7 +172,9 @@ func (c *PluginConfig) discoverExternalComponents(path string) error {
} }
for pluginName, pluginPath := range pluginPaths { for pluginName, pluginPath := range pluginPaths {
newPath := pluginPath // this needs to be stored in a new variable for the func below newPath := pluginPath // this needs to be stored in a new variable for the func below
c.DataSources.Set(pluginName, c.Client(newPath).Datasource) c.DataSources.Set(pluginName, func() (packersdk.Datasource, error) {
return c.Client(newPath).Datasource()
})
externallyUsed = append(externallyUsed, pluginName) externallyUsed = append(externallyUsed, pluginName)
} }
if len(externallyUsed) > 0 { if len(externallyUsed) > 0 {