From 22b63666de41bf62b008cff709168c5e84a0bf3b Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 9 Dec 2016 07:33:01 -0500 Subject: [PATCH] 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 --- inc/meta-config | 3 ++- tests/test_meta_config.sh | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/inc/meta-config b/inc/meta-config index 6252135747..be73b60800 100644 --- a/inc/meta-config +++ b/inc/meta-config @@ -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 diff --git a/tests/test_meta_config.sh b/tests/test_meta_config.sh index 92f9c01f69..087aaf468b 100755 --- a/tests/test_meta_config.sh +++ b/tests/test_meta_config.sh @@ -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