Allow listing all module nodes with moduleName:*
Change-Id: I1c9d8ace936641db06f38c292655b3c5c5557385
diff --git a/src/netconf_access.cpp b/src/netconf_access.cpp
index 13fec88..c1bd5dc 100644
--- a/src/netconf_access.cpp
+++ b/src/netconf_access.cpp
@@ -64,15 +64,13 @@
}
};
- if (path == "/") {
- for (auto it : m_session->getConfig(NC_DATASTORE_RUNNING)->tree_for()) {
+ auto config = m_session->getConfig(NC_DATASTORE_RUNNING, (path != "/") ? std::optional{path} : std::nullopt);
+
+ if (config) {
+ for (auto it : config->tree_for()) {
fillMap(it->tree_dfs());
}
- } else {
- auto data = m_session->getConfig(NC_DATASTORE_RUNNING, path);
- fillMap(data->tree_dfs());
}
-
return res;
}