Merge ~medicalwei/plainbox-provider-checkbox:fix-ssid-colon into plainbox-provider-checkbox:master

Proposed by Yao Wei
Status: Merged
Merged at revision: 6f10dd7b0a530c084c526c081cf34fc77ff69ef9
Proposed branch: ~medicalwei/plainbox-provider-checkbox:fix-ssid-colon
Merge into: plainbox-provider-checkbox:master
Diff against target: 22 lines (+2/-2)
1 file modified
bin/wifi_nmcli_test.py (+2/-2)
Reviewer Review Type Date Requested Status
Jonathan Cave (community) Approve
Review via email: mp+413392@code.launchpad.net

Commit message

Avoid error when WiFi SSID and NM connection name has colon in it.

Description of the change

When we run checkbox test with a AP that has a colon in the name, the script nmcli_test.py fails.

This workarounds the issue by limiting the string split.

Similar issue might also occur in the connection name of nm.

To post a comment you must log in.
Revision history for this message
Jonathan Cave (jocave) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/wifi_nmcli_test.py b/bin/wifi_nmcli_test.py
2index e2c0a52..6fc5eb4 100755
3--- a/bin/wifi_nmcli_test.py
4+++ b/bin/wifi_nmcli_test.py
5@@ -48,7 +48,7 @@ def cleanup_nm_connections():
6 print_cmd(cmd)
7 output = sp.check_output(cmd, shell=True)
8 for line in output.decode(sys.stdout.encoding).splitlines():
9- type, uuid, name = line.strip().split(':')
10+ type, uuid, name = line.strip().split(':', 2)
11 if type == '802-11-wireless':
12 print("Deleting connection", name)
13 cmd = "nmcli c delete {}".format(uuid)
14@@ -83,7 +83,7 @@ def list_aps(args):
15 # lp bug #1723372 - extra line in output on zesty
16 if line.strip() == args.device:
17 continue
18- ssid, channel, frequency, signal = line.strip().split(':')
19+ ssid, channel, frequency, signal = line.strip().rsplit(':', 3)
20 print("SSID: {} Chan: {} Freq: {} Signal: {}".format(
21 ssid, channel, frequency, signal))
22 if hasattr(args, 'essid'):

Subscribers

People subscribed via source and target branches