* Command field of clixon-lib:process-control RPC reply used CDATA encoding but now uses regular XML encoding

This commit is contained in:
Olof hagsand 2022-01-27 09:55:31 +01:00
parent e116e51791
commit bdc09851f0
4 changed files with 16 additions and 10 deletions

View file

@ -36,6 +36,12 @@
## 5.6.0 ## 5.6.0
Expected: March 2022 Expected: March 2022
### API changes on existing protocol/config features
Users may have to change how they access the system
* Command field of clixon-lib:process-control RPC reply used CDATA encoding but now uses regular XML encoding
### Corrected Bugs ### Corrected Bugs
* Fixed: More than one unknown/extension in combination with augment of extension resulted in extension being skipped. * Fixed: More than one unknown/extension in combination with augment of extension resulted in extension being skipped.

View file

@ -705,15 +705,15 @@ clixon_process_status(clicon_handle h,
if (pe->pe_description) if (pe->pe_description)
cprintf(cbret, "<description xmlns=\"%s\">%s</description>", CLIXON_LIB_NS, pe->pe_description); cprintf(cbret, "<description xmlns=\"%s\">%s</description>", CLIXON_LIB_NS, pe->pe_description);
cprintf(cbret, "<command xmlns=\"%s\">", CLIXON_LIB_NS); cprintf(cbret, "<command xmlns=\"%s\">", CLIXON_LIB_NS);
/* the command may include any data, including XML (such as restconf -R command) and /* The command may include any data, including XML (such as restconf -R
therefore needs CDATA encoding */ * command) and therefore needs explicit encoding */
cprintf(cbret, "<![CDATA[");
for (i=0; i<pe->pe_argc-1; i++){ for (i=0; i<pe->pe_argc-1; i++){
if (i) if (i)
cprintf(cbret, " "); if (xml_chardata_cbuf_append(cbret, " ") < 0)
cprintf(cbret, "%s", pe->pe_argv[i]); goto done;
if (xml_chardata_cbuf_append(cbret, pe->pe_argv[i]) < 0)
goto done;
} }
cprintf(cbret, "]]>");
cprintf(cbret, "</command>"); cprintf(cbret, "</command>");
cprintf(cbret, "<status xmlns=\"%s\">%s</status>", CLIXON_LIB_NS, cprintf(cbret, "<status xmlns=\"%s\">%s</status>", CLIXON_LIB_NS,
clicon_int2str(proc_state_map, pe->pe_state)); clicon_int2str(proc_state_map, pe->pe_state));

View file

@ -119,10 +119,10 @@ EOF
err "No pid return value" "$retx" err "No pid return value" "$retx"
fi fi
if $active; then if $active; then
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS><!\[CDATA\[/.*/.*/clixon_restconf -f $cfg -D [0-9] .*\]\]></command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>]]>]]>$" expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>]]>]]>$"
else else
# inactive, no startime or pid # inactive, no startime or pid
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS><!\[CDATA\[/.*/clixon_restconf -f $cfg -D [0-9] .*\]\]></command><status $LIBNS>$status</status></rpc-reply>]]>]]>$" expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status></rpc-reply>]]>]]>$"
fi fi
match=$(echo "$retx" | grep --null -Go "$expect") match=$(echo "$retx" | grep --null -Go "$expect")
if [ -z "$match" ]; then if [ -z "$match" ]; then

View file

@ -135,10 +135,10 @@ EOF
fi fi
if $active; then if $active; then
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS><!\[CDATA\[/.*/.*/clixon_restconf -f $cfg -D [0-9] .*\]\]></command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>]]>]]>$" expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>]]>]]>$"
else else
# inactive, no startime or pid # inactive, no startime or pid
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS><!\[CDATA\[/.*/clixon_restconf -f $cfg -D [0-9] .*\]\]></command><status $LIBNS>$status</status></rpc-reply>]]>]]>$" expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status></rpc-reply>]]>]]>$"
fi fi
match=$(echo "$retx" | grep --null -Go "$expect") match=$(echo "$retx" | grep --null -Go "$expect")
if [ -z "$match" ]; then if [ -z "$match" ]; then