Added several fields to process-control status operation: active, description, command, status, starttime, pid
This commit is contained in:
parent
7e9a207ab2
commit
07d196dfd0
8 changed files with 144 additions and 58 deletions
|
|
@ -1584,7 +1584,6 @@ from_client_process_control(clicon_handle h,
|
|||
cxobj *x;
|
||||
char *name = NULL;
|
||||
char *opstr = NULL;
|
||||
uint32_t pid = 0;
|
||||
proc_operation op = PROC_OP_NONE;
|
||||
|
||||
if ((x = xml_find_type(xe, NULL, "name", CX_ELMNT)) != NULL)
|
||||
|
|
@ -1594,16 +1593,16 @@ from_client_process_control(clicon_handle h,
|
|||
op = clixon_process_op_str2int(opstr);
|
||||
}
|
||||
/* Make the actual process operation (with wrap function enabled) */
|
||||
if (clixon_process_operation(h, name, op, 1, &pid) < 0)
|
||||
goto done;
|
||||
if (op == PROC_OP_STATUS)
|
||||
cprintf(cbret, "<rpc-reply xmlns=\"%s\"><status xmlns=\"%s\">%s</status><pid xmlns=\"%s\">%u</pid></rpc-reply>",
|
||||
NETCONF_BASE_NAMESPACE,
|
||||
CLIXON_LIB_NS, pid?"true":"false",
|
||||
CLIXON_LIB_NS, pid);
|
||||
else
|
||||
if (op == PROC_OP_STATUS){
|
||||
if (clixon_process_status(h, name, cbret) < 0)
|
||||
goto done;
|
||||
}
|
||||
else{
|
||||
if (clixon_process_operation(h, name, op, 1) < 0)
|
||||
goto done;
|
||||
cprintf(cbret, "<rpc-reply xmlns=\"%s\"><ok xmlns=\"%s\"/></rpc-reply>",
|
||||
NETCONF_BASE_NAMESPACE, CLIXON_LIB_NS);
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ restconf_pseudo_process_control(clicon_handle h)
|
|||
argv[i++] = NULL;
|
||||
assert(i==nr);
|
||||
if (clixon_process_register(h, RESTCONF_PROCESS,
|
||||
"Clixon RESTCONF process",
|
||||
NULL /* XXX network namespace */,
|
||||
restconf_rpc_wrapper,
|
||||
argv, nr) < 0)
|
||||
|
|
@ -196,7 +197,7 @@ restconf_pseudo_process_commit(clicon_handle h,
|
|||
if ((cx = xpath_first(xtarget, NULL, "/restconf/enable")) != NULL &&
|
||||
xml_flag(cx, XML_FLAG_CHANGE|XML_FLAG_ADD)){
|
||||
if (clixon_process_operation(h, RESTCONF_PROCESS,
|
||||
enabled?PROC_OP_START:PROC_OP_STOP, 0, NULL) < 0)
|
||||
enabled?PROC_OP_START:PROC_OP_STOP, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
else if (enabled){ /* If something changed and running, restart process */
|
||||
|
|
@ -209,7 +210,7 @@ restconf_pseudo_process_commit(clicon_handle h,
|
|||
* Specifically, the socket is terminated where the reply is sent, which will
|
||||
* cause the curl to fail.
|
||||
*/
|
||||
if (clixon_process_operation(h, RESTCONF_PROCESS, PROC_OP_RESTART, 0, NULL) < 0)
|
||||
if (clixon_process_operation(h, RESTCONF_PROCESS, PROC_OP_RESTART, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue