net/keepalived: on virtual IP allow empty device option
authorFlorian Eckert <redacted>
Thu, 16 Nov 2017 09:47:23 +0000 (10:47 +0100)
committerFlorian Eckert <redacted>
Mon, 22 Jan 2018 14:32:56 +0000 (15:32 +0100)
If ip is referenced in the instance section it is not necessary to add a
device option on every "ip_address". In most sitution it es enough to
add only an ip. Allow empty device option will solve this issue.

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

index 778777b671a166546c74425091cb0eb6820f7633..8f50161cdb9cdb559eb0ffe7920729e6fbc43050 100644 (file)
@@ -123,13 +123,17 @@ print_ipaddress_indent() {
        # Default indent
        [ -z "$indent" ] && indent=$INDENT_1
 
-       # If no address or device exit
-       [ -z "$address" -o -z "$device" ] && return 0
+       # If no address exit
+       [ -z "$address" ] && return 0
 
-       # Add IP address/netmask and device
-       printf "$indent$address dev $device" >> $KEEPALIVED_CONF
-       # Add scope
-       [ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF
+       if [ -z "$device" ]; then
+               printf "$indent$address" >> $KEEPALIVED_CONF
+       else
+               # Add IP address/netmask and device
+               printf "$indent$address dev $device" >> $KEEPALIVED_CONF
+               # Add scope
+               [ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF
+       fi
 
        printf "\n" >> $KEEPALIVED_CONF
 }
git clone https://git.99rst.org/PROJECT