Fixed: [with-defaults=trim does not work due to dodgy handling of state data marked as default](https://github.com/clicon/clixon/issues/348)

This commit is contained in:
Olof hagsand 2022-08-10 15:17:37 +02:00
parent 71fe10a057
commit f3ab3006e8
3 changed files with 19 additions and 8 deletions

View file

@ -206,12 +206,6 @@ get_client_statedata(clicon_handle h,
clicon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
/* Add default state to config if present */
if (xml_default_recurse(*xret, 1) < 0)
goto done;
/* Add default global state */
if (xml_global_defaults(h, *xret, nsc, xpath, yspec, 1) < 0)
goto done;
if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC5277")){
if ((ymod = yang_find_module_by_name(yspec, "clixon-rfc5277")) == NULL){
clicon_err(OE_YANG, ENOENT, "yang module clixon-rfc5277 not found");
@ -261,6 +255,12 @@ get_client_statedata(clicon_handle h,
goto done;
if (ret == 0)
goto fail;
/* Add default state to config if present */
if (xml_default_recurse(*xret, 1) < 0)
goto done;
/* Add default global state */
if (xml_global_defaults(h, *xret, nsc, xpath, yspec, 1) < 0)
goto done;
retval = 1; /* OK */
done:
clicon_debug(1, "%s %d", __FUNCTION__, retval);