summaryrefslogtreecommitdiff
diff options
authorSylvain Pineau <sylvain.pineau@canonical.com>2015-11-20 12:17:29 +0100
committerSylvain Pineau <sylvain.pineau@canonical.com>2015-11-20 12:17:29 +0100
commit5ed4a4776c4001052673b9b38235930b0b0d7580 (patch)
treecd3209111d1b4b01c740178baeddee21e37a7130
parentadb3c97af1cf40ef776187d4b07343f2f14a3979 (diff)
providers:checkbox:wireless: Fix the ethernet restore command
The previous command didn't work on precise (incompatible nmcli version) The following command is able to return the last ethernet connection UUID: nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)" All jobs using connect_wireless have been patched (including jobs in both suspend.txt and wireless.txt). Moreover the fix to https://bugs.launchpad.net/bugs/1471663 left a big issue. The exit status was the result of the ethernet restore call, not the result of iperf nor gateway ping test. this is also fixed by this patch. Fixes https://bugs.launchpad.net/plainbox-provider-checkbox/+bug/1517786
-rw-r--r--jobs/suspend.txt.in72
-rw-r--r--jobs/wireless.txt.in68
2 files changed, 105 insertions, 35 deletions
diff --git a/jobs/suspend.txt.in b/jobs/suspend.txt.in
index 3d30133..eab6e7d 100644
--- a/jobs/suspend.txt.in
+++ b/jobs/suspend.txt.in
@@ -694,11 +694,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -723,11 +725,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -752,11 +756,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -781,11 +787,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -811,11 +819,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -841,11 +851,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -870,11 +882,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -899,11 +913,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -928,11 +944,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -957,11 +975,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -987,11 +1007,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -1017,11 +1039,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -1116,11 +1140,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -1154,11 +1180,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -1192,11 +1220,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -1230,11 +1260,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -1268,11 +1300,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -1306,11 +1340,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
diff --git a/jobs/wireless.txt.in b/jobs/wireless.txt.in
index a619a4a..540c75d 100644
--- a/jobs/wireless.txt.in
+++ b/jobs/wireless.txt.in
@@ -63,11 +63,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -91,11 +93,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -119,11 +123,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -147,11 +153,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -176,11 +184,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -205,11 +215,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -233,11 +245,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -270,11 +284,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -308,11 +324,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -346,11 +364,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -384,11 +404,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -422,11 +444,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -459,11 +483,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
iperf -c $SERVER_IPERF -t 300 -i 30
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -486,11 +512,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
iperf -c $SERVER_IPERF -t 300 -i 30 -u -b 100m -p 5050
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -513,11 +541,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -541,11 +571,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi
@@ -588,11 +620,13 @@ command:
INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'`
iw dev $INTERFACE link
gateway_ping_test --interface=$INTERFACE
+ STATUS=$?
# We reconnect the Ethernet connection if any (lp:1471663)
- WIRED=$((nmcli -f CONNECTIONS dev list 2>&1 || nmcli -f CONNECTIONS dev show) | grep -oP "\S+(?= \| Wired)")
+ WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)")
if [[ ! -z $WIRED ]]; then
nmcli c up uuid $WIRED
fi
+ exit $STATUS
else
exit 1
fi