From 8b272a3163b566ddb7b3b3dc7ad634b6a42ec65a Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 2 May 2017 11:43:27 -0700 Subject: [PATCH] config: Improve config migrate messaging. (#4216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous message ``` Migration from version ‘17’ to ‘18’ completed successfully. ``` For example didn't provide any meaningful insights. This PR attempts to improve this message as below ``` Configuration file '/home/harsha/.minio/config.json' migrated from version '17' to '18' successfully. ``` Fixes #4199 --- cmd/config-migrate.go | 47 +++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/cmd/config-migrate.go b/cmd/config-migrate.go index 79289cde3..f06f5ddf8 100644 --- a/cmd/config-migrate.go +++ b/cmd/config-migrate.go @@ -24,6 +24,9 @@ import ( "github.com/minio/minio/pkg/quick" ) +// DO NOT EDIT following message template, please open a github issue to discuss instead. +var configMigrateMSGTemplate = "Configuration file %s migrated from version '%s' to '%s' successfully.\n" + func migrateConfig() error { // Purge all configs with version '1'. if err := purgeV1(); err != nil { @@ -69,27 +72,27 @@ func migrateConfig() error { if err := migrateV11ToV12(); err != nil { return err } - // Migration version '12' to '13'. + // Migrate version '12' to '13'. if err := migrateV12ToV13(); err != nil { return err } - // Migration version '13' to '14'. + // Migrate version '13' to '14'. if err := migrateV13ToV14(); err != nil { return err } - // Migration version '14' to '15'. + // Migrate version '14' to '15'. if err := migrateV14ToV15(); err != nil { return err } - // Migration version '15' to '16'. + // Migrate version '15' to '16'. if err := migrateV15ToV16(); err != nil { return err } - // Migration version '16' to '17'. + // Migrate version '16' to '17'. if err := migrateV16ToV17(); err != nil { return err } - // Migration version '17' to '18'. + // Migrate version '17' to '18'. if err := migrateV17ToV18(); err != nil { return err } @@ -171,7 +174,7 @@ func migrateV2ToV3() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv2.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv2.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv2.Version, srvConfig.Version) return nil } @@ -209,7 +212,7 @@ func migrateV3ToV4() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv3.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv3.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv3.Version, srvConfig.Version) return nil } @@ -250,7 +253,7 @@ func migrateV4ToV5() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv4.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv4.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv4.Version, srvConfig.Version) return nil } @@ -318,7 +321,7 @@ func migrateV5ToV6() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv5.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv5.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv5.Version, srvConfig.Version) return nil } @@ -374,7 +377,7 @@ func migrateV6ToV7() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv6.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv6.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv6.Version, srvConfig.Version) return nil } @@ -437,7 +440,7 @@ func migrateV7ToV8() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv7.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv7.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv7.Version, srvConfig.Version) return nil } @@ -507,7 +510,7 @@ func migrateV8ToV9() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv8.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv8.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv8.Version, srvConfig.Version) return nil } @@ -575,7 +578,7 @@ func migrateV9ToV10() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv9.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv9.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv9.Version, srvConfig.Version) return nil } @@ -646,7 +649,7 @@ func migrateV10ToV11() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv10.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv10.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv10.Version, srvConfig.Version) return nil } @@ -735,7 +738,7 @@ func migrateV11ToV12() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv11.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv11.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv11.Version, srvConfig.Version) return nil } @@ -815,7 +818,7 @@ func migrateV12ToV13() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv12.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv12.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv12.Version, srvConfig.Version) return nil } @@ -900,7 +903,7 @@ func migrateV13ToV14() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv13.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv13.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv13.Version, srvConfig.Version) return nil } @@ -989,7 +992,7 @@ func migrateV14ToV15() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv14.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv14.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv14.Version, srvConfig.Version) return nil } @@ -1087,7 +1090,7 @@ func migrateV15ToV16() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv15.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv15.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv15.Version, srvConfig.Version) return nil } @@ -1208,7 +1211,7 @@ func migrateV16ToV17() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv16.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv16.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv16.Version, srvConfig.Version) return nil } @@ -1312,6 +1315,6 @@ func migrateV17ToV18() error { return fmt.Errorf("Failed to migrate config from ‘%s’ to ‘%s’. %v", cv17.Version, srvConfig.Version, err) } - log.Printf("Migration from version ‘%s’ to ‘%s’ completed successfully.\n", cv17.Version, srvConfig.Version) + log.Printf(configMigrateMSGTemplate, configFile, cv17.Version, srvConfig.Version) return nil }