rearranged default code to be outside of copying in xml_get inner loop, and that no defaults are computed if no yang binding is made

This commit is contained in:
Olof hagsand 2020-09-09 15:52:54 +02:00
parent 8f8b49331f
commit 804b329301
10 changed files with 251 additions and 166 deletions

View file

@ -1650,7 +1650,6 @@ from_client_msg(clicon_handle h,
if ((ret = nacm_access_pre(h, ce->ce_username, username, &xnacm)) < 0)
goto done;
/* Cache XML NACM tree here. Use with caution, only valid on from_client_msg stack
*
*/
if (clicon_nacm_cache_set(h, xnacm) < 0)
goto done;

View file

@ -198,7 +198,6 @@ startup_common(clicon_handle h,
clicon_err(OE_YANG, 0, "Yang spec not set");
goto done;
}
clicon_debug(1, "Reading startup config done");
/* Clear flags xpath for get */
xml_apply0(xt, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
@ -251,8 +250,16 @@ startup_common(clicon_handle h,
goto done;
goto fail;
}
/* Sort xml */
if (xml_sort_recurse(xt) < 0)
goto done;
/* Add global defaults. */
if (xml_global_defaults(h, xt, NULL, NULL, yspec) < 0)
goto done;
/* Apply default values (removed in clear function) */
if (xml_default_recurse(xt) < 0)
goto done;
/* Handcraft transition with with only add tree */
td->td_target = xt;
xt = NULL;

View file

@ -238,7 +238,7 @@ startup_extraxml(clicon_handle h,
goto fail;
}
/*
* Check if tmp db is empty. XXX no this is not possible.
* Check if tmp db is empty.
* It should be empty if extra-xml is null and reset plugins did nothing
* then skip validation.
*/

View file

@ -86,8 +86,8 @@ struct backend_handle {
int bh_magic; /* magic (HDR)*/
clicon_hash_t *bh_copt; /* clicon option list (HDR) */
clicon_hash_t *bh_data; /* internal clicon data (HDR) */
clicon_hash_t *ch_db_elmnt; /* xml datastore element cache data */
event_stream_t *bh_stream; /* notification streams, see clixon_stream.[ch] */
clicon_hash_t *ch_db_elmnt; /* xml datastore element cache data */
event_stream_t *bh_stream; /* notification streams, see clixon_stream.[ch] */
/* ------ end of common handle ------ */
struct client_entry *bh_ce_list; /* The client list */