Support MultiStrOpt options in configuration file.

Fixed bug #1136964.

1. Added 3 ini functions to support MultiStrOpt:
  Function "iniset_multiline config-file section option value1 value2
value3 ..." sets a MultiStrOpt option in an ini file.

  Function "iniget_multiline config-file section option" gets the
MultiStrOpt option values.

  Function "iniadd config-file section option value1 value2 value3..."
appends an option without relacing the old values, which would result
the option to be MultiStrOpt.

2. Modified the nova configuation to correctly enable notification for
ceilometer.

Change-Id: I1c27db1a6e58b35bc4428e761f40627988f69e37
This commit is contained in:
Lianhao Lu
2013-03-01 15:54:02 +08:00
parent 0d71d1ec56
commit 239f3246ad
3 changed files with 83 additions and 2 deletions

View File

@@ -60,6 +60,10 @@ spaces = yes
[ddd]
empty =
[eee]
multi = foo1
multi = foo2
EOF
# Test with spaces
@@ -193,6 +197,34 @@ else
echo "inicomment failed: $VAL"
fi
# Test multiple line iniset/iniget
iniset_multiline test.ini eee multi bar1 bar2
VAL=$(iniget_multiline test.ini eee multi)
if [[ "$VAL" == "bar1 bar2" ]]; then
echo "OK: iniset_multiline"
else
echo "iniset_multiline failed: $VAL"
fi
# Test iniadd with exiting values
iniadd test.ini eee multi bar3
VAL=$(iniget_multiline test.ini eee multi)
if [[ "$VAL" == "bar1 bar2 bar3" ]]; then
echo "OK: iniadd"
else
echo "iniadd failed: $VAL"
fi
# Test iniadd with non-exiting values
iniadd test.ini eee non-multi foobar1 foobar2
VAL=$(iniget_multiline test.ini eee non-multi)
if [[ "$VAL" == "foobar1 foobar2" ]]; then
echo "OK: iniadd with non-exiting value"
else
echo "iniadd with non-exsting failed: $VAL"
fi
rm test.ini
# Enabling/disabling services