aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2013-04-02 17:58:35 +0200
committerLukas Nykryn <lnykryn@redhat.com>2013-04-02 18:00:08 +0200
commit983001ecfe7018a849a591462ac6d1f16c31433b (patch)
treee4a733752f7baf9375e98a33118f127d7001b6e9
parent16a93c9d652a360d0805f885e730f8a5c6f2fee1 (diff)
downloadinitscripts-983001ecfe7018a849a591462ac6d1f16c31433b.tar
initscripts-983001ecfe7018a849a591462ac6d1f16c31433b.tar.gz
initscripts-983001ecfe7018a849a591462ac6d1f16c31433b.tar.bz2
initscripts-983001ecfe7018a849a591462ac6d1f16c31433b.tar.xz
initscripts-983001ecfe7018a849a591462ac6d1f16c31433b.zip
ifdown: don't call nmcli on interface that is alread down
-rwxr-xr-xsysconfig/network-scripts/ifdown7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 6bd1073d..b78e9438 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -46,8 +46,11 @@ if [ "$_use_nm" = "true" ]; then
DEVICE=$(nmcli -t --fields uuid,devices con status | awk -F ':' "\$1 == \"$UUID\" { print \$2 }")
fi
if [ -n "$DEVICE" ] && ! is_nm_device_unmanaged "$DEVICE" ; then
- nmcli dev disconnect iface "$DEVICE"
- exit $?
+ if ! LC_ALL=C nmcli -t -f STATE,DEVICE dev status | egrep -q "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then
+ nmcli dev disconnect iface "$DEVICE"
+ exit $?
+ fi
+ exit 0
fi
fi