confd: add error handling in case of failed bootstrap or load

- New script 'error' that can be overridden by a br2-external
 - Call 'error' if YANG model bootstap or factory-config.gen fails
 - Call 'error' if loading startup-config or failure-config fails

The 'error' script calls syslog¹ to log the error messge:

    The device has reached an unrecoverable error, please RMA.
____
¹ to get a timestamp log message, and send remote in case a
  br2-external has somehow hard-coded network for remote syslog

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-10-09 10:41:46 +02:00
committed by Tobias Waldekranz
parent f357b1df3b
commit 787955d877
5 changed files with 18 additions and 4 deletions
+9 -2
View File
@@ -1,7 +1,11 @@
#set DEBUG=1
run name:bootstrap log:prio:user.notice <pid/syslogd> \
[S] /usr/libexec/confd/bootstrap -- Bootstrapping YANG datastore
run name:bootstrap log:prio:user.notice norestart <pid/syslogd> \
[S] /usr/libexec/confd/bootstrap \
-- Bootstrapping YANG datastore
run name:error :1 log:console norestart if:<run/bootstrap/failure> \
[S] /usr/libexec/confd/error --
service name:sysrepo log <pid/syslogd> \
[S12345789] sysrepo-plugind -f -p /run/sysrepo.pid -n -v3 -- Configuration daemon
@@ -16,6 +20,9 @@ run name:failure log:prio:user.critical norestart if:<run/startup/failure> \
[S] <pid/sysrepo> /usr/libexec/confd/load failure-config \
-- Loading failure-config
run name:error :2 log:console norestart if:<run/startup/failure> \
[S] /usr/libexec/confd/error --
service name:netopeer log \
[12345789] <pid/sysrepo> netopeer2-server -F -t 60 \
-- NETCONF server
+1 -2
View File
@@ -1,6 +1,5 @@
SUBDIRS = src yang share
SUBDIRS = bin share src yang
dist_doc_DATA = README.md LICENSE
dist_sysconf_DATA = confdrc
pkglibexec_SCRIPTS = $(wildcard bin/*)
DISTCLEANFILES = *~ *.d
ACLOCAL_AMFLAGS = -I m4
+2
View File
@@ -0,0 +1,2 @@
pkglibexec_SCRIPTS = bootstrap error load \
gen-hostkeys gen-hostname gen-interfaces
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
# Override using an overlay in your br2-external to change the behavior
logger -sik -p user.error "The device has reached an unrecoverable error, please RMA."
exec sleep infinity
+1
View File
@@ -5,6 +5,7 @@ AM_SILENT_RULES(yes)
AC_CONFIG_FILES([
Makefile
bin/Makefile
share/Makefile
share/factory.d/Makefile
share/failure.d/Makefile