From: Kefu Chai Date: Thu, 24 Dec 2020 14:16:52 +0000 (+0800) Subject: vstart: format the customized options in ceph.conf X-Git-Tag: v16.1.0~131^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38714%2Fhead;p=ceph.git vstart: format the customized options in ceph.conf better formatted in ceph.conf, no extra spaces and tabs anymore. Signed-off-by: Kefu Chai --- diff --git a/src/vstart.sh b/src/vstart.sh index b3f8993c20c..21f26b851a1 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -408,8 +408,7 @@ case $1 in shift ;; -o) - extra_conf="$extra_conf $2 -" + extra_conf+=$'\n'"$2" shift ;; --cache) @@ -549,6 +548,21 @@ done } +format_conf() { + local opts=$1 + local indent=" " + local opt + local formatted + while read -r opt; do + if [ -z "$formatted" ]; then + formatted="${opt}" + else + formatted+=$'\n'${indent}${opt} + fi + done <<< "$opts" + echo "$formatted" +} + prepare_conf() { local DAEMONOPTS=" log file = $CEPH_OUT_DIR/\$name.log @@ -565,22 +579,16 @@ prepare_conf() { local msgr_conf='' if [ $msgr -eq 21 ]; then - msgr_conf=" - ms bind msgr2 = true - ms bind msgr1 = true -"; + msgr_conf="ms bind msgr2 = true + ms bind msgr1 = true" fi if [ $msgr -eq 2 ]; then - msgr_conf=" - ms bind msgr2 = true - ms bind msgr1 = false -"; + msgr_conf="ms bind msgr2 = true + ms bind msgr1 = false" fi if [ $msgr -eq 1 ]; then - msgr_conf=" - ms bind msgr2 = false - ms bind msgr1 = true -"; + msgr_conf="ms bind msgr2 = false + ms bind msgr1 = true" fi wconf <