Reject mandatory KVS if not set for any sub-sys (#8641)

master
Harshavardhana 5 years ago committed by GitHub
parent f5abe4e1f1
commit ca62ac65d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      cmd/config/config.go

@ -644,6 +644,15 @@ func (c Config) SetKVS(s string, defaultKVS map[string]KVS) error {
currKVS.Set(Comment, v) 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 c[subSys][tgt] = currKVS
return nil return nil
} }

Loading…
Cancel
Save