Warn instead of die on undefined config names

When using local.conf in multinode envs not everything is going to be
defined in all places. Eventually we probably want to make it so we
have a host role for these sections or something. But for now warn
instead of die when we can't find a config var.

Change-Id: I6959099373f035fbfe9e540a44e4c52b8e7c95c0
Closes-Bug: #2000824
This commit is contained in:
Sean Dague 2016-12-09 07:33:01 -05:00
parent 8040232e05
commit 22b63666de
2 changed files with 9 additions and 5 deletions

View File

@ -181,7 +181,8 @@ function merge_config_group {
realconfigfile=$(eval "echo $configfile")
if [[ -z $realconfigfile ]]; then
die $LINENO "bogus config file specification: $configfile is undefined"
warn $LINENO "unknown config file specification: $configfile is undefined"
break
fi
dir=$(dirname $realconfigfile)
if [[ -d $dir ]]; then

View File

@ -29,6 +29,10 @@ function die {
exit -1
}
function warn {
return 0
}
TEST_1C_ADD="[eee]
type=new
multi = foo2"
@ -92,7 +96,7 @@ $TEST_1C_ADD
[[test3|test-space.conf]]
[DEFAULT]
attribute=value
# the above line has a single space
[[test4|\$TEST4_DIR/\$TEST4_FILE]]
@ -378,11 +382,10 @@ set -e
echo -n "merge_config_group test9 undefined conf file: "
set +e
# function is expected to fail and exit, running it
# in a subprocess to let this script proceed
# function is expected to trigger warn and continue
(merge_config_group test.conf test9)
VAL=$?
EXPECT_VAL=255
EXPECT_VAL=0
check_result "$VAL" "$EXPECT_VAL"
set -e