Browse code

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

Sean Dague authored on 2016/12/09 21:33:01
Showing 2 changed files
... ...
@@ -181,7 +181,8 @@ function merge_config_group {
181 181
 
182 182
             realconfigfile=$(eval "echo $configfile")
183 183
             if [[ -z $realconfigfile ]]; then
184
-                die $LINENO "bogus config file specification: $configfile is undefined"
184
+                warn $LINENO "unknown config file specification: $configfile is undefined"
185
+                break
185 186
             fi
186 187
             dir=$(dirname $realconfigfile)
187 188
             if [[ -d $dir ]]; then
... ...
@@ -29,6 +29,10 @@ function die {
29 29
     exit -1
30 30
 }
31 31
 
32
+function warn {
33
+    return 0
34
+}
35
+
32 36
 TEST_1C_ADD="[eee]
33 37
 type=new
34 38
 multi = foo2"
... ...
@@ -92,7 +96,7 @@ $TEST_1C_ADD
92 92
 [[test3|test-space.conf]]
93 93
 [DEFAULT]
94 94
 attribute=value
95
- 
95
+
96 96
 # the above line has a single space
97 97
 
98 98
 [[test4|\$TEST4_DIR/\$TEST4_FILE]]
... ...
@@ -378,11 +382,10 @@ set -e
378 378
 
379 379
 echo -n "merge_config_group test9 undefined conf file: "
380 380
 set +e
381
-# function is expected to fail and exit, running it
382
-# in a subprocess to let this script proceed
381
+# function is expected to trigger warn and continue
383 382
 (merge_config_group test.conf test9)
384 383
 VAL=$?
385
-EXPECT_VAL=255
384
+EXPECT_VAL=0
386 385
 check_result "$VAL" "$EXPECT_VAL"
387 386
 set -e
388 387