Merge lp:~brendan-donegan/checkbox/bug861502_reconnect_wireless into lp:checkbox

Proposed by Brendan Donegan
Status: Merged
Merged at revision: 1083
Proposed branch: lp:~brendan-donegan/checkbox/bug861502_reconnect_wireless
Merge into: lp:checkbox
Diff against target: 43 lines (+3/-7)
3 files modified
debian/changelog (+1/-0)
jobs/suspend.txt.in (+2/-2)
scripts/reconnect (+0/-5)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/bug861502_reconnect_wireless
Reviewer Review Type Date Requested Status
Ara Pulido (community) Approve
Brendan Donegan (community) Needs Resubmitting
Review via email: mp+77474@code.launchpad.net

Description of the change

The wireless before/after suspend tests used to save just the name of the interface which was connected before the test ran. This proved sufficient in most cases, but didn't truly reflect the connections that were actually in place before the test. This was a problem in some situations - so this change updates the job command to store the connections using 'nmcli con status' and then restore them using 'nmcli con up'

The reconnect script has also been removed as I felt that the code to do the reconnect was terse enough not to require a separate script.

To post a comment you must log in.
Revision history for this message
Ara Pulido (ara) wrote :

Instead of saving just the SSID name, nmcli saves "Auto <SSID>", so this fix fails for me:

ara@sushirider:~/curro/checkbox/checkbox/trunk/scripts$ nmcli -t -f NAME con status > $CHECKBOX_DATA/connections && ./connect_wireless && ./internet_test --interface=`nmcli dev list | grep -B 1 wireless | grep GENERAL.DEVICE | awk '{print $2}'` && while read CON; do nmcli con up "$CON"; done < $CHECKBOX_DATA/connections
Error: Device 'eth0' (/org/freedesktop/NetworkManager/Devices/0) disconnecting failed: This device is not active
Device state: 30 (disconnected)
Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/6
state: activated
Connection activated
Internet connection fully established
Unknown parameter: Auto Musireta
Error: id or uuid has to be specified.

review: Needs Fixing
Revision history for this message
Ara Pulido (ara) wrote :

A more reliable way to do it.

To save the UUID of the connection:

$ nmcli -f UUID con status

To then reconnect to that connection:

nmcli con up uuid $CON

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

I'm sure I tested this exact command and it worked, but looking at it now I see I left out the 'id' keyword from the 'nmcli con up' call.

Note that to better understand what is going on here you should know that the name of the *connection* not the SSID of the router is being saved. These are often similar or identical - but nmcli con up needs the connection name itself to work properly.

review: Needs Resubmitting
1083. By Brendan Donegan

Left out id from nmcli con up.

1084. By Brendan Donegan

Using UUID instead of name to ensure they are the same connection.

1085. By Brendan Donegan

vim typo

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Sticky keys introduced an extra 'i' on line 30 thanks to vim :(

review: Needs Resubmitting
Revision history for this message
Ara Pulido (ara) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-09-29 06:58:55 +0000
3+++ debian/changelog 2011-09-29 09:18:23 +0000
4@@ -9,6 +9,7 @@
5 * Remove storage_devices_test from Ubuntu Friendly whitelist since bonnie++ (which it uses) is not installed by default (LP: #855841)
6 * Changed description and name to reflect Ubuntu Friendly branding. Now when a user searches for Ubuntu Friendly in the lens, Checkbox will appear (LP: #852036)
7 * Reset the selections at the test suite prompt if No is selected at the recover prompt (LP: #861208)
8+ * Save the connection name(s) instead of the interface name so that they can be reconnected to properly after the wireless before/after suspend tests have completed (LP: #861502)
9
10 [Daniel Manrique]
11 * Restored _recover attribute, re-enabling welcome and test selection
12
13=== modified file 'jobs/suspend.txt.in'
14--- jobs/suspend.txt.in 2011-09-22 16:26:54 +0000
15+++ jobs/suspend.txt.in 2011-09-29 09:18:23 +0000
16@@ -30,7 +30,7 @@
17 plugin: shell
18 name: suspend/wireless_before_suspend
19 depends: networking/wireless_connection
20-command: nmcli -t -f DEVICES con status > $CHECKBOX_DATA/iface && connect_wireless && internet_test --interface=`nmcli dev list | grep -B 1 wireless | grep GENERAL.DEVICE | awk '{print $2}'` && reconnect `cat $CHECKBOX_DATA/iface`
21+command: nmcli -t -f UUID con status > $CHECKBOX_DATA/connections && connect_wireless && internet_test --interface=`nmcli dev list | grep -B 1 wireless | grep GENERAL.DEVICE | awk '{print $2}'` && for con in `cat $CHECKBOX_DATA/connections`; do nmcli con up uuid "$con"; done
22 _description:
23 This test disconnects all connections and then connects to the wireless
24 interface. It then checks the connection to confirm it's working as expected.
25@@ -111,7 +111,7 @@
26 plugin: shell
27 name: suspend/wireless_after_suspend
28 depends: suspend/suspend_advanced suspend/wireless_before_suspend
29-command: connect_wireless && internet_test --interface=`nmcli dev list | grep -B 1 wireless | grep GENERAL.DEVICE | awk '{print $2}'` && reconnect `cat $CHECKBOX_DATA/iface`
30+command: connect_wireless && internet_test --interface=`nmcli dev list | grep -B 1 wireless | grep GENERAL.DEVICE | awk '{print $2}'` && for con in `cat $CHECKBOX_DATA/connections`; do nmcli con up uuid "$con"; done
31 _description:
32 This test checks that the wireless interface is working after suspending the system. It
33 disconnects all interfaces and then connects to the wireless interface and checks that the
34
35=== removed file 'scripts/reconnect'
36--- scripts/reconnect 2011-08-05 10:56:43 +0000
37+++ scripts/reconnect 1970-01-01 00:00:00 +0000
38@@ -1,5 +0,0 @@
39-#!/bin/bash
40-
41-iface=$1
42-
43-nmcli con up id "$(nmcli -t -f NAME,TYPE con list | grep -m 1 `nmcli dev list iface $iface | grep GENERAL.TYPE | awk '{print $2}'` | awk -F: '{print $1}')"

Subscribers

People subscribed via source and target branches