confd: load test-config when in test-mode

This commit is contained in:
Ahmed Karic
2024-08-23 11:15:12 +02:00
committed by Mattias Walström
parent 4a325af4e4
commit 837fb0ee7f
+12 -1
View File
@@ -1,5 +1,5 @@
#!/bin/sh
# load [-b] <startup-config | failure-config>
# load [-b] <startup-config | failure-config | test-config>
#
# Import a configuration to the sysrepo datastore using `sysrepocfg -Ifile`
#
@@ -41,6 +41,17 @@ err()
. /etc/confdrc
config=$1
if [ -f "/mnt/aux/test-mode" ] && [ "$config" = "startup-config" ]; then
if [ -f "/mnt/aux/test-override-startup" ]; then
rm -f "/mnt/aux/test-override-startup"
else
note "Test mode detected, switching to test-config"
config="test-config"
fi
fi
if [ -f "$config" ]; then
fn="$config"
else