* 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
|
||||
|
||||
* 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
|
||||
* Improved error messages for YANG identityref:s and leafref:s by adding original line numbers
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* cligen */
|
||||
#include <cligen/cligen.h>
|
||||
|
|
@ -246,6 +247,8 @@ restconf_pseudo_process_control(clicon_handle h)
|
|||
int nr;
|
||||
cbuf *cb = NULL;
|
||||
char *dir = NULL;
|
||||
char *pgm;
|
||||
struct stat fstat;
|
||||
|
||||
nr = 10;
|
||||
if ((argv = calloc(nr, sizeof(char *))) == NULL){
|
||||
|
|
@ -269,7 +272,15 @@ restconf_pseudo_process_control(clicon_handle h)
|
|||
}
|
||||
}
|
||||
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++] = clicon_option_str(h, "CLICON_CONFIGFILE");
|
||||
/* Add debug if backend has debug.
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@
|
|||
#ifdef HAVE_SETNS /* linux network namespaces */
|
||||
#include <sched.h> /* setns / unshare */
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/param.h>
|
||||
|
|
@ -271,6 +272,7 @@ clixon_proc_background(char **argv,
|
|||
sigfn_t oldhandler = NULL;
|
||||
sigset_t oset;
|
||||
struct rlimit rlim = {0, };
|
||||
struct stat fstat;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
if (argv == NULL){
|
||||
|
|
@ -284,6 +286,11 @@ clixon_proc_background(char **argv,
|
|||
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 */
|
||||
sigprocmask(0, NULL, &oset);
|
||||
set_signal(SIGINT, clixon_proc_sigint, &oldhandler);
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ fi
|
|||
#: ${OPENCONFIG=$(pwd)/public} # just skip if not set
|
||||
|
||||
# Standard IETF RFC yang files.
|
||||
: ${IETFRFC=../yang/standard}
|
||||
: ${IETFRFC=../yang/mandatory}
|
||||
|
||||
# Some restconf tests can run IPv6, but its complicated because:
|
||||
# - docker by default does not run IPv6
|
||||
|
|
|
|||
|
|
@ -485,6 +485,9 @@ new "kill restconf"
|
|||
sleep $DEMSLEEP
|
||||
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"
|
||||
endtest
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue