* Restconf internal start: fail early if clixon_restconf binary is not found
* If CLICON_BACKEND_RESTCONF_PROCESS is true
This commit is contained in:
parent
980718178a
commit
8352e25860
5 changed files with 31 additions and 8 deletions
|
|
@ -65,6 +65,8 @@ Users may have to change how they access the system
|
||||||
|
|
||||||
### Minor features
|
### Minor features
|
||||||
|
|
||||||
|
* Restconf internal start: fail early if clixon_restconf binary is not found
|
||||||
|
* If CLICON_BACKEND_RESTCONF_PROCESS is true
|
||||||
* Added linenumbers to all YANG symbols for better debug and errors
|
* Added linenumbers to all YANG symbols for better debug and errors
|
||||||
* Improved error messages for YANG identityref:s and leafref:s by adding original line numbers
|
* Improved error messages for YANG identityref:s and leafref:s by adding original line numbers
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
/* cligen */
|
/* cligen */
|
||||||
#include <cligen/cligen.h>
|
#include <cligen/cligen.h>
|
||||||
|
|
@ -240,12 +241,14 @@ restconf_rpc_wrapper(clicon_handle h,
|
||||||
static int
|
static int
|
||||||
restconf_pseudo_process_control(clicon_handle h)
|
restconf_pseudo_process_control(clicon_handle h)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char **argv = NULL;
|
char **argv = NULL;
|
||||||
int i;
|
int i;
|
||||||
int nr;
|
int nr;
|
||||||
cbuf *cb = NULL;
|
cbuf *cb = NULL;
|
||||||
char *dir = NULL;
|
char *dir = NULL;
|
||||||
|
char *pgm;
|
||||||
|
struct stat fstat;
|
||||||
|
|
||||||
nr = 10;
|
nr = 10;
|
||||||
if ((argv = calloc(nr, sizeof(char *))) == NULL){
|
if ((argv = calloc(nr, sizeof(char *))) == NULL){
|
||||||
|
|
@ -269,7 +272,15 @@ restconf_pseudo_process_control(clicon_handle h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cprintf(cb, "%s/clixon_restconf", dir);
|
cprintf(cb, "%s/clixon_restconf", dir);
|
||||||
argv[i++] = cbuf_get(cb);
|
pgm = cbuf_get(cb);
|
||||||
|
/* Sanity check: program exists */
|
||||||
|
if (stat(pgm, &fstat) < 0) {
|
||||||
|
clicon_err(OE_FATAL, errno, "%s, you may have set CLICON_BACKEND_RESTCONF_PROCESS but clixon_restconf is not found in %s. Try overriding with CLICON_RESTCONF_INSTALLDIR",
|
||||||
|
pgm,
|
||||||
|
CLIXON_CONFIG_SBINDIR);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
argv[i++] = pgm;
|
||||||
argv[i++] = "-f";
|
argv[i++] = "-f";
|
||||||
argv[i++] = clicon_option_str(h, "CLICON_CONFIGFILE");
|
argv[i++] = clicon_option_str(h, "CLICON_CONFIGFILE");
|
||||||
/* Add debug if backend has debug.
|
/* Add debug if backend has debug.
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@
|
||||||
#ifdef HAVE_SETNS /* linux network namespaces */
|
#ifdef HAVE_SETNS /* linux network namespaces */
|
||||||
#include <sched.h> /* setns / unshare */
|
#include <sched.h> /* setns / unshare */
|
||||||
#endif
|
#endif
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
@ -271,6 +272,7 @@ clixon_proc_background(char **argv,
|
||||||
sigfn_t oldhandler = NULL;
|
sigfn_t oldhandler = NULL;
|
||||||
sigset_t oset;
|
sigset_t oset;
|
||||||
struct rlimit rlim = {0, };
|
struct rlimit rlim = {0, };
|
||||||
|
struct stat fstat;
|
||||||
|
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
clicon_debug(1, "%s", __FUNCTION__);
|
||||||
if (argv == NULL){
|
if (argv == NULL){
|
||||||
|
|
@ -284,6 +286,11 @@ clixon_proc_background(char **argv,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Sanity check: program exists */
|
||||||
|
if (stat(argv[0], &fstat) < 0) {
|
||||||
|
clicon_err(OE_FATAL, errno, "%s", argv[0]);
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
/* Before here call quit on error */
|
/* Before here call quit on error */
|
||||||
sigprocmask(0, NULL, &oset);
|
sigprocmask(0, NULL, &oset);
|
||||||
set_signal(SIGINT, clixon_proc_sigint, &oldhandler);
|
set_signal(SIGINT, clixon_proc_sigint, &oldhandler);
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ fi
|
||||||
#: ${OPENCONFIG=$(pwd)/public} # just skip if not set
|
#: ${OPENCONFIG=$(pwd)/public} # just skip if not set
|
||||||
|
|
||||||
# Standard IETF RFC yang files.
|
# Standard IETF RFC yang files.
|
||||||
: ${IETFRFC=../yang/standard}
|
: ${IETFRFC=../yang/mandatory}
|
||||||
|
|
||||||
# Some restconf tests can run IPv6, but its complicated because:
|
# Some restconf tests can run IPv6, but its complicated because:
|
||||||
# - docker by default does not run IPv6
|
# - docker by default does not run IPv6
|
||||||
|
|
|
||||||
|
|
@ -485,6 +485,9 @@ new "kill restconf"
|
||||||
sleep $DEMSLEEP
|
sleep $DEMSLEEP
|
||||||
stop_restconf
|
stop_restconf
|
||||||
|
|
||||||
|
new "Start backend with wrong restconf bindir"
|
||||||
|
expectpart "$(sudo $clixon_backend -Fs init -f $cfg -l o -o CLICON_RESTCONF_INSTALLDIR=/usr/local/xxxx)" 255 "FATAL: /usr/local/xxxx/clixon_restconf" "No such file or directory"
|
||||||
|
|
||||||
new "endtest"
|
new "endtest"
|
||||||
endtest
|
endtest
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue