Apply dynamic config at sub-system level (#14369)

Currently, when applying any dynamic config, the system reloads and
re-applies the config of all the dynamic sub-systems.

This PR refactors the code in such a way that changing config of a given
dynamic sub-system will work on only that sub-system.
This commit is contained in:
Shireesh Anjal
2022-02-23 00:29:28 +05:30
committed by GitHub
parent 0cbdc458c5
commit 94d37d05e5
3 changed files with 89 additions and 88 deletions

View File

@@ -813,18 +813,16 @@ func GetSubSys(s string) (subSys string, inputs []string, tgt string, e error) {
return subSys, inputs, tgt, Errorf("input arguments cannot be empty")
}
inputs = strings.SplitN(s, KvSpaceSeparator, 2)
if len(inputs) <= 1 {
return subSys, inputs, tgt, Errorf("invalid number of arguments '%s'", s)
}
subSystemValue := strings.SplitN(inputs[0], SubSystemSeparator, 2)
if len(subSystemValue) == 0 {
return subSys, inputs, tgt, Errorf("invalid number of arguments %s", s)
}
if !SubSystems.Contains(subSystemValue[0]) {
subSystemValue := strings.SplitN(inputs[0], SubSystemSeparator, 2)
subSys = subSystemValue[0]
if !SubSystems.Contains(subSys) {
return subSys, inputs, tgt, Errorf("unknown sub-system %s", s)
}
subSys = subSystemValue[0]
if len(inputs) == 1 {
return subSys, inputs, tgt, nil
}
if SubSystemsSingleTargets.Contains(subSystemValue[0]) && len(subSystemValue) == 2 {
return subSys, inputs, tgt, Errorf("sub-system '%s' only supports single target", subSystemValue[0])