Better message on reset of dynamic config (#3861)
When a dynamic config is reset, the minio api response has `true` as value of the header `x-minio-config-applied`. In such cases, mc should not show the message asking the user to restart `minio`.
This commit is contained in:
@@ -61,6 +61,7 @@ EXAMPLES:
|
||||
type configResetMessage struct {
|
||||
Status string `json:"status"`
|
||||
targetAlias string
|
||||
restart bool
|
||||
}
|
||||
|
||||
// String colorized service status message.
|
||||
@@ -68,8 +69,11 @@ func (u configResetMessage) String() (msg string) {
|
||||
msg += console.Colorize("ResetConfigSuccess",
|
||||
"Key is successfully reset.\n")
|
||||
suggestion := fmt.Sprintf("mc admin service restart %s", u.targetAlias)
|
||||
msg += console.Colorize("ResetConfigSuccess",
|
||||
fmt.Sprintf("Please restart your server with `%s`.\n", suggestion))
|
||||
if u.restart {
|
||||
msg += console.Colorize("ResetConfigSuccess",
|
||||
fmt.Sprintf("Please restart your server with `%s`.\n", suggestion))
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -123,12 +127,13 @@ func mainAdminConfigReset(ctx *cli.Context) error {
|
||||
|
||||
// Call reset config API
|
||||
input := strings.Join(args.Tail(), " ")
|
||||
fatalIf(probe.NewError(client.DelConfigKV(globalContext, input)),
|
||||
"Unable to reset '%s' on the server", input)
|
||||
restart, e := client.DelConfigKV(globalContext, input)
|
||||
fatalIf(probe.NewError(e), "Unable to reset '%s' on the server", input)
|
||||
|
||||
// Print set config result
|
||||
printMsg(configResetMessage{
|
||||
targetAlias: aliasedURL,
|
||||
restart: restart,
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,7 @@ require (
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/colorjson v1.0.1
|
||||
github.com/minio/filepath v1.0.0
|
||||
github.com/minio/madmin-go v1.1.11-0.20211102182201-e51fd3d6b104
|
||||
github.com/minio/madmin-go v1.1.13
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/minio-go/v7 v7.0.15-0.20211004160302-3b57c1e369ca
|
||||
github.com/minio/pkg v1.1.3
|
||||
|
||||
@@ -273,8 +273,8 @@ github.com/minio/colorjson v1.0.1/go.mod h1:oPM3zQQY8Gz9NGtgvuBEjQ+gPZLKAGc7T+kj
|
||||
github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY=
|
||||
github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw=
|
||||
github.com/minio/madmin-go v1.0.12/go.mod h1:BK+z4XRx7Y1v8SFWXsuLNqQqnq5BO/axJ8IDJfgyvfs=
|
||||
github.com/minio/madmin-go v1.1.11-0.20211102182201-e51fd3d6b104 h1:/N0JW/1+vbxdDgCI8+tac7GXKkis6rh8kVsLNejN6Ug=
|
||||
github.com/minio/madmin-go v1.1.11-0.20211102182201-e51fd3d6b104/go.mod h1:Iu0OnrMWNBYx1lqJTW+BFjBMx0Hi0wjw8VmqhiOs2Jo=
|
||||
github.com/minio/madmin-go v1.1.13 h1:uIY5q88TGOx10iDsLvPT4ylTe8Nw8vctn9hRvk9z91A=
|
||||
github.com/minio/madmin-go v1.1.13/go.mod h1:Iu0OnrMWNBYx1lqJTW+BFjBMx0Hi0wjw8VmqhiOs2Jo=
|
||||
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
|
||||
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
||||
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
||||
|
||||
Reference in New Issue
Block a user