Commit 0dd80c0e authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

config file doesn't need to exist if set [GH-2225]

parent a3863c34
...@@ -217,12 +217,10 @@ func loadConfig() (*config, error) { ...@@ -217,12 +217,10 @@ func loadConfig() (*config, error) {
return nil, err return nil, err
} }
mustExist := true
configFilePath := os.Getenv("PACKER_CONFIG") configFilePath := os.Getenv("PACKER_CONFIG")
if configFilePath == "" { if configFilePath == "" {
var err error var err error
configFilePath, err = configFile() configFilePath, err = configFile()
mustExist = false
if err != nil { if err != nil {
log.Printf("Error detecting default config file path: %s", err) log.Printf("Error detecting default config file path: %s", err)
...@@ -240,11 +238,7 @@ func loadConfig() (*config, error) { ...@@ -240,11 +238,7 @@ func loadConfig() (*config, error) {
return nil, err return nil, err
} }
if mustExist { log.Println("[WARN] Config file doesn't exist: %s", configFilePath)
return nil, err
}
log.Println("File doesn't exist, but doesn't need to. Ignoring.")
return &config, nil return &config, nil
} }
defer f.Close() defer f.Close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment