Removed sending restconf config inline using -R when CLICON_BACKEND_RESTCONF_PROCESS=true

Define RESTCONF_INLINE to revert
This commit is contained in:
Olof hagsand 2023-08-15 20:33:06 +02:00
parent fc73493881
commit 7352894c7e
3 changed files with 22 additions and 4 deletions

View file

@ -147,7 +147,6 @@ restconf_pseudo_set_inline(clicon_handle h,
char **argv;
int argc;
int i;
char *str = NULL;
cxobj *xrestconf;
cbuf *cb = NULL;
@ -158,6 +157,8 @@ restconf_pseudo_set_inline(clicon_handle h,
for (i=0; i<argc; i++){
if (argv[i] == NULL)
break;
#ifdef RESTCONF_INLINE
char *str;
if (strcmp(argv[i], "-R") == 0 && argc > i+1 && argv[i+1]){
if ((cb = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new");
@ -175,6 +176,7 @@ restconf_pseudo_set_inline(clicon_handle h,
argv[i+1] = str;
break;
}
#endif
}
retval = 0;
done:
@ -253,7 +255,10 @@ restconf_pseudo_process_control(clicon_handle h)
struct stat fstat;
int found = 0;
nr = 10;
nr = 8; /* pgm -f <file> -D <dbg> -l <log> NULL */
#ifdef RESTCONF_INLINE
nr += 2;
#endif
if ((argv = calloc(nr, sizeof(char *))) == NULL){
clicon_err(OE_UNIX, errno, "calloc");
goto done;
@ -307,8 +312,10 @@ restconf_pseudo_process_control(clicon_handle h)
argv[i++] = "0";
argv[i++] = "-l";
argv[i++] = "s"; /* There is also log-destination in clixon-restconf.yang */
#ifdef RESTCONF_INLINE
argv[i++] = "-R";
argv[i++] = "";
argv[i++] = ""; /* The content is set in restconf_pseudo_set_inline */
#endif
argv[i++] = NULL;
assert(i==nr);
if (clixon_process_register(h, RESTCONF_PROCESS,
@ -374,7 +381,7 @@ restconf_pseudo_process_commit(clicon_handle h,
if (xpath_first(xtarget, NULL, "/restconf[enable='true']") != NULL)
enabled++;
/* Get debug flag of restconf config, set the restconf start -D daemon flag according
* to it. The restconf daemon cannoit read its debug flag from config initially,
* to it. The restconf daemon cannot read its debug flag from config initially,
* but in this way it is set directly in its input args.
* Its a trick.
*/