Thomas Vachuska
Committed by Gerrit Code Review

FIxed netcfg CLI to avoid double-nesting configs.

Change-Id: I4b988cdf437c40059b3f2bbfcff4e216eadea034
......@@ -63,7 +63,7 @@ public class NetworkConfigCommand extends AbstractShellCommand {
if (isNullOrEmpty(configKey)) {
addSubject(root, s);
} else {
addSubjectConfig(root, getConfig(s, configKey));
root = getSubjectConfig(getConfig(s, configKey));
}
}
}
......@@ -86,14 +86,11 @@ public class NetworkConfigCommand extends AbstractShellCommand {
}
private void addSubject(ObjectNode root, Object s) {
service.getConfigs(s)
.forEach(c -> addSubjectConfig(newObject(root, c.key()), getConfig(s, c.key())));
service.getConfigs(s).forEach(c -> root.set(c.key(), c.node()));
}
private void addSubjectConfig(ObjectNode root, Config config) {
if (config != null) {
root.set(config.key(), config.node());
}
private ObjectNode getSubjectConfig(Config config) {
return config != null ? config.node() : null;
}
private Config getConfig(Object s, String ck) {
......