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

This commit is contained in:
Harshavardhana 2019-12-12 14:55:07 -08:00 committed by GitHub
parent f5abe4e1f1
commit ca62ac65d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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
} }