Skip to content

Commit

Permalink
packer: fix splitting error message on pathsep
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajolet-hashicorp committed May 16, 2024
1 parent ec92d23 commit 97db9d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packer/plugin_folders.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import (
"github.com/hashicorp/packer-plugin-sdk/pathing"
)

var pathSep = fmt.Sprintf("%c", os.PathListSeparator)

// PluginFolder returns the known plugin folder based on system.
func PluginFolder() (string, error) {
if packerPluginPath := os.Getenv("PACKER_PLUGIN_PATH"); packerPluginPath != "" {
if strings.ContainsRune(packerPluginPath, os.PathListSeparator) {
if strings.Contains(packerPluginPath, pathSep) {
return "", fmt.Errorf("Multiple paths are no longer supported for PACKER_PLUGIN_PATH.\n"+
"This should be defined as one of the following options for your environment:"+
"\n* PACKER_PLUGIN_PATH=%v", strings.Join(strings.Split(packerPluginPath, ":"), "\n* PACKER_PLUGIN_PATH="))
"\n* PACKER_PLUGIN_PATH=%v", strings.Join(strings.Split(packerPluginPath, pathSep), "\n* PACKER_PLUGIN_PATH="))
}

return packerPluginPath, nil
Expand Down

0 comments on commit 97db9d8

Please sign in to comment.