From c525424179d04663e83627a90dfd62d0631a9d8e Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Wed, 9 May 2018 15:11:24 -0700 Subject: [PATCH] Return detailed msg for notification errors (#5913) --- cmd/common-main.go | 18 +++++++++--------- cmd/gateway-main.go | 6 +++--- cmd/net.go | 2 +- cmd/server-main.go | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/common-main.go b/cmd/common-main.go index 7a5531fa4..9c026db2c 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -44,10 +44,10 @@ func checkUpdate(mode string) { func initConfig() { // Config file does not exist, we create it fresh and return upon success. if isFile(getConfigFile()) { - logger.FatalIf(migrateConfig(), "Config migration failed.") + logger.FatalIf(migrateConfig(), "Config migration failed") logger.FatalIf(loadConfig(), "Unable to load the configuration file") } else { - logger.FatalIf(newConfig(), "Unable to initialize minio config for the first time.") + logger.FatalIf(newConfig(), "Unable to initialize minio config for the first time") logger.Info("Created minio configuration file successfully at " + getConfigDir()) } } @@ -71,12 +71,12 @@ func handleCommonCmdArgs(ctx *cli.Context) { // default config directory. configDir = getConfigDir() if configDir == "" { - logger.FatalIf(errors.New("missing option"), "config-dir option must be provided.") + logger.FatalIf(errors.New("missing option"), "config-dir option must be provided") } } if configDir == "" { - logger.FatalIf(errors.New("empty directory"), "Configuration directory cannot be empty.") + logger.FatalIf(errors.New("empty directory"), "Configuration directory cannot be empty") } // Disallow relative paths, figure out absolute paths. @@ -140,7 +140,7 @@ func handleCommonEnvVars() { if excludes := os.Getenv("MINIO_CACHE_EXCLUDE"); excludes != "" { excludeList, err := parseCacheExcludes(strings.Split(excludes, cacheEnvDelimiter)) if err != nil { - logger.Fatal(err, "Unable to parse MINIO_CACHE_EXCLUDE value (`%s`).", excludes) + logger.Fatal(err, "Unable to parse MINIO_CACHE_EXCLUDE value (`%s`)", excludes) } globalCacheExcludes = excludeList } @@ -165,25 +165,25 @@ func handleCommonEnvVars() { // Check for environment variables and parse into storageClass struct if ssc := os.Getenv(standardStorageClassEnv); ssc != "" { globalStandardStorageClass, err = parseStorageClass(ssc) - logger.FatalIf(err, "Invalid value set in environment variable %s.", standardStorageClassEnv) + logger.FatalIf(err, "Invalid value set in environment variable %s", standardStorageClassEnv) } if rrsc := os.Getenv(reducedRedundancyStorageClassEnv); rrsc != "" { globalRRStorageClass, err = parseStorageClass(rrsc) - logger.FatalIf(err, "Invalid value set in environment variable %s.", reducedRedundancyStorageClassEnv) + logger.FatalIf(err, "Invalid value set in environment variable %s", reducedRedundancyStorageClassEnv) } // Validation is done after parsing both the storage classes. This is needed because we need one // storage class value to deduce the correct value of the other storage class. if globalRRStorageClass.Scheme != "" { err = validateParity(globalStandardStorageClass.Parity, globalRRStorageClass.Parity) - logger.FatalIf(err, "Invalid value set in environment variable %s.", reducedRedundancyStorageClassEnv) + logger.FatalIf(err, "Invalid value set in environment variable %s", reducedRedundancyStorageClassEnv) globalIsStorageClass = true } if globalStandardStorageClass.Scheme != "" { err = validateParity(globalStandardStorageClass.Parity, globalRRStorageClass.Parity) - logger.FatalIf(err, "Invalid value set in environment variable %s.", standardStorageClassEnv) + logger.FatalIf(err, "Invalid value set in environment variable %s", standardStorageClassEnv) globalIsStorageClass = true } } diff --git a/cmd/gateway-main.go b/cmd/gateway-main.go index ae34e4cd4..8c2fc7421 100644 --- a/cmd/gateway-main.go +++ b/cmd/gateway-main.go @@ -109,7 +109,7 @@ func init() { // StartGateway - handler for 'minio gateway '. func StartGateway(ctx *cli.Context, gw Gateway) { if gw == nil { - logger.FatalIf(errUnexpected, "Gateway implementation not initialized, exiting.") + logger.FatalIf(errUnexpected, "Gateway implementation not initialized") } // Disable logging until gateway initialization is complete, any @@ -156,7 +156,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) { } // Create certs path. - logger.FatalIf(createConfigDir(), "Unable to create configuration directories.") + logger.FatalIf(createConfigDir(), "Unable to create configuration directories") // Initialize gateway config. initConfig() @@ -173,7 +173,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) { // Create new notification system. globalNotificationSys, err = NewNotificationSys(globalServerConfig, EndpointList{}) - logger.FatalIf(err, "Unable to create new notification system.") + logger.FatalIf(err, "Unable to create new notification system") // Create new policy system. globalPolicySys = NewPolicySys() diff --git a/cmd/net.go b/cmd/net.go index 380bfc9ed..47b79890b 100644 --- a/cmd/net.go +++ b/cmd/net.go @@ -48,7 +48,7 @@ func mustSplitHostPort(hostPort string) (host, port string) { func mustGetLocalIP4() (ipList set.StringSet) { ipList = set.NewStringSet() addrs, err := net.InterfaceAddrs() - logger.FatalIf(err, "Unable to get IP addresses of this host.") + logger.FatalIf(err, "Unable to get IP addresses of this host") for _, addr := range addrs { var ip net.IP diff --git a/cmd/server-main.go b/cmd/server-main.go index da11203de..4882de587 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -246,13 +246,13 @@ func serverMain(ctx *cli.Context) { var handler http.Handler handler, err = configureServerHandler(globalEndpoints) if err != nil { - logger.Fatal(uiErrUnexpectedError(err), "Unable to configure one of server's RPC services.") + logger.Fatal(uiErrUnexpectedError(err), "Unable to configure one of server's RPC services") } // Create new notification system. globalNotificationSys, err = NewNotificationSys(globalServerConfig, globalEndpoints) if err != nil { - logger.Fatal(uiErrUnexpectedError(err), "Unable to create new notification system.") + logger.Fatal(err, "Unable to initialize the notification system") } // Create new policy system.