output errors to the proper location in main.go [GH-288]

This commit is contained in:
Mitchell Hashimoto 2014-10-11 13:03:11 -07:00
parent dac5f0e3df
commit 1510f12efc
2 changed files with 6 additions and 5 deletions

View File

@ -60,6 +60,7 @@ BUG FIXES:
* core: Fix many edge cases surrounding the `count` meta-parameter.
* core: Strings in the configuration can escape double-quotes with the
standard `\"` syntax.
* core: Error parsing CLI config will show properly. [GH-288]
* providers/aws: autoscaling_group can be launched into a vpc [GH-259]
* providers/aws: not an error when RDS instance is deleted manually. [GH-307]
* providers/aws: Retry deleting subnet for some time while AWS eventually

10
main.go
View File

@ -88,7 +88,7 @@ func wrappedMain() int {
// Load the configuration
config := BuiltinConfig
if err := config.Discover(); err != nil {
fmt.Fprintf(os.Stderr, "Error discovering plugins: %s", err)
Ui.Error(fmt.Sprintf("Error discovering plugins: %s", err))
return 1
}
@ -123,14 +123,14 @@ func wrappedMain() int {
// define extra providers and provisioners.
clicfgFile, err := cliConfigFile()
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading CLI configuration: \n\n%s\n", err)
Ui.Error(fmt.Sprintf("Error loading CLI configuration: \n\n%s", err))
return 1
}
if clicfgFile != "" {
usrcfg, err := LoadConfig(clicfgFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading CLI configuration: \n\n%s\n", err)
Ui.Error(fmt.Sprintf("Error loading CLI configuration: \n\n%s", err))
return 1
}
@ -143,7 +143,7 @@ func wrappedMain() int {
exitCode, err := cli.Run()
if err != nil {
fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())
Ui.Error(fmt.Sprintf("Error executing CLI: %s", err.Error()))
return 1
}
@ -155,7 +155,7 @@ func cliConfigFile() (string, error) {
configFilePath := os.Getenv("TERRAFORM_CONFIG")
if configFilePath == "" {
var err error
configFilePath, err = configFile()
configFilePath, err = ConfigFile()
mustExist = false
if err != nil {