From ca62ac65d4448641e0e82d9d20bbae1bcdaf4466 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 12 Dec 2019 14:55:07 -0800 Subject: [PATCH] Reject mandatory KVS if not set for any sub-sys (#8641) --- cmd/config/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/config/config.go b/cmd/config/config.go index 165855714..55638f9de 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -644,6 +644,15 @@ func (c Config) SetKVS(s string, defaultKVS map[string]KVS) error { currKVS.Set(Comment, v) } + hkvs := HelpSubSysMap[subSys] + for _, hkv := range hkvs { + v, _ := currKVS.Lookup(hkv.Key) + if v == "" && !hkv.Optional { + return Errorf(SafeModeKind, + "'%s' is not optional for '%s' sub-system, please check '%s' documentation", + hkv.Key, subSys, subSys) + } + } c[subSys][tgt] = currKVS return nil }