Removed default of CLICON_RESTCONF_INSTALLDIR

* The default behaviour is changed to use the config $(sbindir) to locate `clixon_restconf` when starting restconf internally
This commit is contained in:
Olof hagsand 2021-07-27 10:53:47 +02:00 committed by Alan Yaniger
parent 5de6d56822
commit 96a3ee98c6
6 changed files with 43 additions and 20 deletions

View file

@ -34,11 +34,21 @@
Expected: September, 2021 Expected: September, 2021
### C/CLI-API changes on existing features ### C/CLI-API changes on existing features
### New features
Developers may need to change their code * Restconf YANG PATCH according to RFC 8072
* Experimental: enable by setting YANG_PATCH in include/clixon_custom.h
* Thanks to Alan Yaniger for providing this patch
### API changes on existing protocol/config features
Users may have to change how they access the system
* Native Restconf is now default, not fcgi/nginx * Native Restconf is now default, not fcgi/nginx
* That is, to configure with fcgi, you need to explicitly configure: `--with-restconf=fcgi` * That is, to configure with fcgi, you need to explicitly configure: `--with-restconf=fcgi`
* New clixon-config@2021-07-11.yang revision
* Removed default of `CLICON_RESTCONF_INSTALLDIR`
* The default behaviour is changed to use the config $(sbindir) to locate `clixon_restconf` when starting restconf internally
### Corrected Bugs ### Corrected Bugs

View file

@ -152,7 +152,9 @@ install-include: clixon_backend.h clixon_backend_handle.h clixon_backend_transac
.SUFFIXES: .c .o .SUFFIXES: .c .o
.c.o: .c.o:
$(CC) $(INCLUDES) $(CPPFLAGS) -D__PROGRAM__=\"$(APPL)\" $(CFLAGS) -c $< # Note: CLIXON_CONFIG_SBINDIR is where clixon_restconf is believed to be installed, unless
# overruled by CLICON_RESTCONF_INSTALLDIR option
$(CC) $(INCLUDES) $(CPPFLAGS) -D__PROGRAM__=\"$(APPL)\" -DCLIXON_CONFIG_SBINDIR=\"$(sbindir)\" $(CFLAGS) -c $<
# Just link test programs # Just link test programs
test.c : test.c :

View file

@ -245,6 +245,7 @@ restconf_pseudo_process_control(clicon_handle h)
int i; int i;
int nr; int nr;
cbuf *cb = NULL; cbuf *cb = NULL;
char *dir = NULL;
nr = 10; nr = 10;
if ((argv = calloc(nr, sizeof(char *))) == NULL){ if ((argv = calloc(nr, sizeof(char *))) == NULL){
@ -256,12 +257,18 @@ restconf_pseudo_process_control(clicon_handle h)
clicon_err(OE_UNIX, errno, "cbuf_new"); clicon_err(OE_UNIX, errno, "cbuf_new");
goto done; goto done;
} }
/* CLICON_RESTCONF_INSTALLDIR is where we think clixon_restconf is installed /* Try to figure out where clixon_restconf is installed
* Problem is where to define it? Now in config file, but maybe it should be in configure? * If config option CLICON_RESTCONF_INSTALLDIR is installed, use that.
* Tried Makefile but didnt work on Docker since it was moved around. * If not, use the Makefile
* Use PATH? * Use PATH?
*/ */
cprintf(cb, "%s/clixon_restconf", clicon_option_str(h, "CLICON_RESTCONF_INSTALLDIR")); if ((dir = clicon_option_str(h, "CLICON_RESTCONF_INSTALLDIR")) == NULL){
if ((dir = CLIXON_CONFIG_SBINDIR) == NULL){
clicon_err(OE_RESTCONF, EINVAL, "Both option CLICON_RESTCONF_INSTALLDIR and makefile constant CLIXON_CONFIG_SBINDIR are NULL which make sit not possible to know where clixon_restconf is installed(shouldnt happen)");
goto done;
}
}
cprintf(cb, "%s/clixon_restconf", dir);
argv[i++] = cbuf_get(cb); argv[i++] = cbuf_get(cb);
argv[i++] = "-f"; argv[i++] = "-f";
argv[i++] = clicon_option_str(h, "CLICON_CONFIGFILE"); argv[i++] = clicon_option_str(h, "CLICON_CONFIGFILE");

View file

@ -23,8 +23,6 @@ startupdb=$dir/startup_db
RESTCONFDBG=$DBG RESTCONFDBG=$DBG
RCPROTO=http # no ssl here RCPROTO=http # no ssl here
RESTCONFDIR=$(dirname $(which clixon_restconf))
# log-destination in restconf xml: syslog or file # log-destination in restconf xml: syslog or file
: ${LOGDST:=syslog} : ${LOGDST:=syslog}
# Set daemon command-line to -f # Set daemon command-line to -f
@ -54,7 +52,6 @@ cat <<EOF > $cfg
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR> <CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP> <CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR> <CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
<CLICON_RESTCONF_INSTALLDIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALLDIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR> <CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE> <CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK> <CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>

View file

@ -34,8 +34,6 @@ startupdb=$dir/startup_db
RESTCONFDBG=$DBG RESTCONFDBG=$DBG
RCPROTO=http # no ssl here RCPROTO=http # no ssl here
RESTCONFDIR=$(dirname $(which clixon_restconf))
INVALIDADDR=251.1.1.1 # used by fourth usecase as invalid INVALIDADDR=251.1.1.1 # used by fourth usecase as invalid
# log-destination in restconf xml: syslog or file # log-destination in restconf xml: syslog or file
@ -68,7 +66,6 @@ cat <<EOF > $cfg
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR> <CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP> <CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR> <CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
<CLICON_RESTCONF_INSTALLDIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALLDIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR> <CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE> <CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK> <CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>

View file

@ -45,8 +45,13 @@ module clixon-config {
revision 2021-07-11 { revision 2021-07-11 {
description description
"Added option "Added option:
CLICON_SYSTEM_CAPABILITIES"; CLICON_SYSTEM_CAPABILITIES
Removed default value:
CLICON_RESTCONF_INSTALLDIR
Marked as obsolete:
CLICON_YANG_LIST_CHECK
(Will be) Released in Clixon 5.3";
} }
revision 2021-05-20 { revision 2021-05-20 {
description description
@ -518,13 +523,18 @@ module clixon-config {
} }
leaf CLICON_RESTCONF_INSTALLDIR { leaf CLICON_RESTCONF_INSTALLDIR {
type string; type string;
default "/usr/local/sbin";
description description
"Path to dir of clixon-restconf daemon binary as used by backend if started internally "If set, path to dir of clixon-restconf daemon binary as used by backend if
Discussion: Somewhat problematic to have it as run time option. It may think it started internally (run-time).
should be known at configure or install time, but for example the main docker If this path is not set, clixon_restconf will be looked for according to
installation moves the binaries, and this may be true elsewehere too. configured installdir: $(sbindir) (install-time)
Maybe one could locate it via PATHs search"; Since programs can be moved around at install/cross-compile time the installed
dir may be difficult to know at install time, which is the reason why
CLICON_RESTCONF_INSTALLDIR exists, in order to override the Makefile
installdir.
Note on the installdir, DESTDIR is not included since according to man pages:
by specifying DESTDIR should not change the operation of the software in
any way, so its value should not be included in any file contents. ";
} }
leaf CLICON_RESTCONF_STARTUP_DONTUPDATE { leaf CLICON_RESTCONF_STARTUP_DONTUPDATE {
type boolean; type boolean;