Skip to content

Commit

Permalink
CLI: optimized show devices (without detail) to not include moint-points
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Jan 28, 2024
1 parent 7611d4b commit 6906c68
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/controller_cli_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,8 +1039,17 @@ cli_show_devices(clixon_handle h,
/* Get config */
if ((nsc = xml_nsctx_init("co", CONTROLLER_NAMESPACE)) == NULL)
goto done;
if (clicon_rpc_get(h, "co:devices", nsc, CONTENT_ALL, -1, "report-all", &xn) < 0)
goto done;
if (detail){
if (clicon_rpc_get(h, "co:devices", nsc, CONTENT_ALL, -1, "report-all", &xn) < 0)
goto done;
}
else{
/* Avoid including moint-point which triggers a lot of extra traffic */
if (clicon_rpc_get(h,
"co:devices/co:device/co:name | co:devices/co:device/co:conn-state | co:devices/co:device/co:conn-state-timestamp | co:devices/co:device/co:logmsg",
nsc, CONTENT_ALL, -1, "explicit", &xn) < 0)
goto done;
}
if ((xerr = xpath_first(xn, NULL, "/rpc-error")) != NULL){
clixon_err_netconf(h, OE_XML, 0, xerr, "Get devices");
goto done;
Expand Down

0 comments on commit 6906c68

Please sign in to comment.