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 { ...@@ -63,7 +63,7 @@ public class NetworkConfigCommand extends AbstractShellCommand {
63 if (isNullOrEmpty(configKey)) { 63 if (isNullOrEmpty(configKey)) {
64 addSubject(root, s); 64 addSubject(root, s);
65 } else { 65 } else {
66 - addSubjectConfig(root, getConfig(s, configKey)); 66 + root = getSubjectConfig(getConfig(s, configKey));
67 } 67 }
68 } 68 }
69 } 69 }
...@@ -86,14 +86,11 @@ public class NetworkConfigCommand extends AbstractShellCommand { ...@@ -86,14 +86,11 @@ public class NetworkConfigCommand extends AbstractShellCommand {
86 } 86 }
87 87
88 private void addSubject(ObjectNode root, Object s) { 88 private void addSubject(ObjectNode root, Object s) {
89 - service.getConfigs(s) 89 + service.getConfigs(s).forEach(c -> root.set(c.key(), c.node()));
90 - .forEach(c -> addSubjectConfig(newObject(root, c.key()), getConfig(s, c.key())));
91 } 90 }
92 91
93 - private void addSubjectConfig(ObjectNode root, Config config) { 92 + private ObjectNode getSubjectConfig(Config config) {
94 - if (config != null) { 93 + return config != null ? config.node() : null;
95 - root.set(config.key(), config.node());
96 - }
97 } 94 }
98 95
99 private Config getConfig(Object s, String ck) { 96 private Config getConfig(Object s, String ck) {
......