Merge lp:~asac/phablet-tools/wait-for-online-with-nm-tool into lp:phablet-tools

Proposed by Alexander Sack
Status: Superseded
Proposed branch: lp:~asac/phablet-tools/wait-for-online-with-nm-tool
Merge into: lp:phablet-tools
Prerequisite: lp:~asac/phablet-tools/improve-network-bringup-console-output
Diff against target: 55 lines (+20/-25)
1 file modified
phablet-network-setup (+20/-25)
To merge this branch: bzr merge lp:~asac/phablet-tools/wait-for-online-with-nm-tool
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+174893@code.launchpad.net

This proposal has been superseded by a proposal from 2013-07-15.

Description of the change

based on lp:~asac/phablet-tools/improve-network-bringup-console-output this code moves to nm-tool for deciding whether a device is online or not...

This time I tested the code for the positive state (dev is online) and negative (stop network-manager).

I don't like the sh -c "..." way of doing this, but couldn't get the | easily wrapped in a variable without doing it that way :)...

To post a comment you must log in.
131. By Alexander Sack

simplify device bringup "wait for online state" code; use nm-tool in phablet-network-setup

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:131
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~asac/phablet-tools/wait-for-online-with-nm-tool/+merge/174893/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/phablet-tools-ci/99/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-tools-saucy-amd64-ci/42
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-tools-saucy-armhf-ci/42
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-tools-saucy-i386-ci/42

Click here to trigger a rebuild:
http://s-jenkins:8080/job/phablet-tools-ci/99/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

131. By Alexander Sack

simplify device bringup "wait for online state" code; use nm-tool in phablet-network-setup

130. By Alexander Sack

improve debugging output of network device and IP bringup code in phablet-network-setup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phablet-network-setup'
2--- phablet-network-setup 2013-07-15 23:50:31 +0000
3+++ phablet-network-setup 2013-07-15 23:50:31 +0000
4@@ -144,31 +144,26 @@
5 apt-get install --yes openssh-server iw
6 EOF
7
8- echo Bringing up Network device...
9- nmcli_cmd="adb $ADBOPTS shell $CHROOTCMD $CHROOTDIR/usr/bin/nmcli"
10- wait=0
11- iface=$($nmcli_cmd -t -f devices con status | tr -d '\r')
12- until [ -n "$iface" ] || [ $wait -eq 10 ]; do
13- echo "Network device ready yet:"
14- $nmcli_cmd c list
15- sleep $(( wait++ ))
16- iface=$($nmcli_cmd -t -f devices con status | tr -d '\r')
17- done
18- if [ -z "$iface" ]; then
19- echo "Network device setup timed out. Bailing out!"
20- exit 1
21- fi
22- wait=0
23- echo Bringing up Network IP for \"$iface\" ...
24- ip_data=$($nmcli_cmd -t dev list iface $iface | grep ADDRESS)
25- until [ -n "$ip_data" ] || [ $wait -eq 10 ]; do
26- echo "Network device \"$iface\" has no IP yet:"
27- sleep $(( wait++ ))
28- ip_data=$($nmcli_cmd -t dev list iface $iface | grep ADDRESS)
29- done
30- if [ -z "$ip_data" ]; then
31- echo "Network IP setup \"$iface\" timed out. Bailing out!"
32- exit 1
33+ echo Bringing up Network...
34+ nm_tool="adb $ADBOPTS shell $CHROOTCMD $CHROOTDIR/usr/bin/nm-tool"
35+ nm_tool_is_online="adb $ADBOPTS shell $CHROOTCMD $CHROOTDIR/usr/bin/nm-tool | grep -q State.*[^s]connected.*global"
36+
37+ wait=0
38+ sh -c "$nm_tool_is_online" && is_online=yes
39+ until [ -n "$is_online" ] || [ $wait -eq 13 ]; do
40+ echo "Network connected yet:"
41+ $nm_tool
42+ sleep $(( wait++ ))
43+ sh -c "$nm_tool_is_online" && is_online=yes
44+ echo Is now online? $online
45+ done
46+ if [ -z "$is_online" ]; then
47+ echo "Network bringup timed out..."
48+ $nm_tool
49+ echo "Bailing out!"
50+ exit 1
51+ else
52+ echo "Network is online! online=$is_online"
53 fi
54
55 echo Installing ssh

Subscribers

People subscribed via source and target branches