diff --git a/common/shell-local/config.go b/common/shell-local/config.go index e3247f73a..b4fae91a4 100644 --- a/common/shell-local/config.go +++ b/common/shell-local/config.go @@ -175,7 +175,8 @@ func Validate(config *Config) error { } } if supported_os != true { - return fmt.Errorf("Invalid OS specified in only_on: '%s'", provided_os) + return fmt.Errorf("Invalid OS specified in only_on: '%s'\n"+ + "Supported OS names: %v", provided_os, supported_syslist) } } } diff --git a/common/shell-local/run.go b/common/shell-local/run.go index 11165a36c..0b87d3e71 100644 --- a/common/shell-local/run.go +++ b/common/shell-local/run.go @@ -29,21 +29,19 @@ type EnvVarsTemplate struct { func Run(ui packer.Ui, config *Config) (bool, error) { // Check if shell-local can even execute against this runtime OS - runCommand := false if len(config.OnlyOn) > 0 { + runCommand := false for _, os := range config.OnlyOn { if os == runtime.GOOS { runCommand = true break } } - } else { - runCommand = true - } - if !runCommand { - ui.Say(fmt.Sprintf("Skipping shell-local due to runtime OS")) - log.Printf("[INFO] (shell-local): skipping shell-local due to missing runtime OS") - return true, nil + if !runCommand { + ui.Say(fmt.Sprintf("Skipping shell-local due to runtime OS")) + log.Printf("[INFO] (shell-local): skipping shell-local due to missing runtime OS") + return true, nil + } } scripts := make([]string, len(config.Scripts))