mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-29 19:24:10 -04:00
backport of commit 172fab6ddd
This commit is contained in:
+1
-2
@@ -6,7 +6,6 @@ package packer
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
@@ -81,7 +80,7 @@ func (c *PluginConfig) Discover() error {
|
||||
}
|
||||
|
||||
if len(c.KnownPluginFolders) == 0 {
|
||||
return errors.New("no known plugin folders defined")
|
||||
c.KnownPluginFolders = PluginFolders()
|
||||
}
|
||||
|
||||
// TODO after JSON is deprecated remove support for legacy component plugins.
|
||||
|
||||
@@ -24,7 +24,6 @@ func newPluginConfig() PluginConfig {
|
||||
var conf PluginConfig
|
||||
conf.PluginMinPort = 10000
|
||||
conf.PluginMaxPort = 25000
|
||||
conf.KnownPluginFolders = []string{os.TempDir()}
|
||||
return conf
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@ import (
|
||||
func PluginFolders(dirs ...string) []string {
|
||||
res := []string{}
|
||||
|
||||
if packerPluginPath := os.Getenv("PACKER_PLUGIN_PATH"); packerPluginPath != "" {
|
||||
res = append(res, strings.Split(packerPluginPath, string(os.PathListSeparator))...)
|
||||
return res
|
||||
}
|
||||
|
||||
if path, err := os.Executable(); err != nil {
|
||||
log.Printf("[ERR] Error finding executable: %v", err)
|
||||
} else {
|
||||
@@ -30,9 +35,5 @@ func PluginFolders(dirs ...string) []string {
|
||||
res = append(res, filepath.Join(cd, "plugins"))
|
||||
}
|
||||
|
||||
if packerPluginPath := os.Getenv("PACKER_PLUGIN_PATH"); packerPluginPath != "" {
|
||||
res = append(res, strings.Split(packerPluginPath, string(os.PathListSeparator))...)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user