Fix incorrect service name on Debian in `add-rule`

On Debian, the iptables-persistent service has been renamed to
netfilter-persistent. The svc-map includes both default, ubuntu,
and debian as ubuntu will "fallback" to debian as they are considered
the same family of distro.

Change-Id: I180a580820015a60ceb2221873a38ebbb06cf953
This commit is contained in:
Kiall Mac Innes 2014-11-10 18:53:30 +00:00
parent d99cf49c9d
commit 64d88fa508
2 changed files with 11 additions and 2 deletions

View File

@ -37,10 +37,15 @@ if [[ "RedHatEnterpriseServer CentOS Fedora" =~ "$DISTRO" ]]; then
fi
elif [[ "Debian Ubuntu" =~ "$DISTRO" ]]; then
service iptables-persistent reload
# NOTE(kiall): os-svc-restart etc don't support the custom 'save'
# action, so we grab the name and call the service
# binary "by hand" instead.
SERVICE_NAME=$(svc-map iptables-persistent)
service $SERVICE_NAME reload
iptables -C $RULE || iptables -I $RULE
service iptables-persistent save
service $SERVICE_NAME save
fi

View File

@ -0,0 +1,4 @@
iptables-persistent:
default: iptables-persistent
ubuntu: iptables-persistent
debian: netfilter-persistent