Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions providers/base/bin/wifi_nmcli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,22 @@ def wait_for_connected(interface, essid):
print_cmd(cmd)
output = sp.check_output(shlex.split(cmd), universal_newlines=True)
print(output)
state, ssid = output.strip().splitlines()
# if state is not connected, no ssid will be provided
state, *ssid = output.strip().splitlines()
ssid = next(iter(ssid), None)

if state.startswith("100") and ssid == essid:
print("Reached connected state with ESSID: {}".format(essid))
elif not state.startswith("100"):
error_msg = "State is not connected: {}".format(state)
raise SystemExit(error_msg)
elif ssid != essid:
error_msg = (
"ERROR: did not reach connected state with ESSID: {}\n"
"ESSID mismatch:\n Excepted:{}\n Actually:{}"
).format(essid, ssid, essid)
raise SystemExit(error_msg)
elif not state.startswith("100"):
error_msg = "State is not connected: {}".format(state)
raise SystemExit(error_msg)

print()


Expand Down
Loading