net/keepalived: add quoting for print_elems_indent function
authorFlorian Eckert <redacted>
Wed, 18 Oct 2017 12:19:34 +0000 (14:19 +0200)
committerFlorian Eckert <redacted>
Mon, 30 Oct 2017 14:40:25 +0000 (15:40 +0100)
If you add a notify_* script which is not only a path to a script or
to a bin file, it is necessary to quote to whole string. If you do not
quote this the config will not get accepted by keepalived and so will
not start. This will fix this issue.

Signed-off-by: Florian Eckert <redacted>
net/keepalived/files/keepalived.init

index 6e850f02d8f5c80f3b39ae7e742dd1e2877ab363..400d12a0139cc91c54a720470bc5e039caaae280 100644 (file)
@@ -49,7 +49,14 @@ print_elems_indent() {
                eval optval=\$$opt
                [ -z "$optval" ] && continue
                printf "$indent$opt" >> $KEEPALIVED_CONF
-               [ "$no_val" == "0" ] && printf " $optval" >> $KEEPALIVED_CONF
+               [ "$no_val" == "0" ] && {
+                       local words=$(echo "$optval" | wc -w)
+                       if [ $words -gt 1 ]; then
+                               printf " \"$optval\"" >> $KEEPALIVED_CONF
+                       else
+                               printf " $optval" >> $KEEPALIVED_CONF
+                       fi
+               }
                printf "\n" >> $KEEPALIVED_CONF
        done
        unset optval
git clone https://git.99rst.org/PROJECT