Merge lp:~smoser/curtinator/fix-default-address into lp:~roadmr/curtinator/trunk

Proposed by Scott Moser on 2018-01-05
Status: Merged
Merged at revision: 5
Proposed branch: lp:~smoser/curtinator/fix-default-address
Merge into: lp:~roadmr/curtinator/trunk
Diff against target: 26 lines (+8/-1)
1 file modified
scripts/curtinator (+8/-1)
To merge this branch: bzr merge lp:~smoser/curtinator/fix-default-address
Reviewer Review Type Date Requested Status
Daniel Manrique 2018-01-05 Approve on 2018-01-05
Review via email: mp+335753@code.launchpad.net

Description of the change

Fix setting of DEFAULT_ADDRESS on bionic.

ifconfig output is fragile, and changed between xenial and bionic.
The change modifies DEFAULT_ADDRESS to use 'ip show dev' rather than
'ifconfig'. Also fails early if no address is found.

To post a comment you must log in.
Daniel Manrique (roadmr) wrote :

This really shows curtinator's age :)

Thanks for this! I'll merge in a sec.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/curtinator'
2--- scripts/curtinator 2016-05-25 20:47:05 +0000
3+++ scripts/curtinator 2018-01-05 15:34:08 +0000
4@@ -6,7 +6,11 @@
5 MIRROR_DIRECTORY=${MIRROR_DIRECTORY:-/ubuntu}
6 MIRROR_PREFIX="http://$MIRROR_HOSTNAME$MIRROR_DIRECTORY"
7
8-DEFAULT_ADDRESS=$(ifconfig virbr0 | sed -n 's/.*inet addr:\([0-9.]\+\)\s.*/\1/p')
9+DEFAULT_ADDRESS=$(
10+ ip address show dev virbr0 |
11+ awk '$1 == "inet" && /scope global/ {
12+ sub(/\/.*/, "", $2); print $2; exit(0); }')
13+
14 DEFAULT_RELEASE=$(lsb_release -c | cut -f 2)
15 DEFAULT_PORT=$(($RANDOM % 1024 + 1024))
16 DEFAULT_ARCHITECTURE=$(dpkg --print-architecture)
17@@ -157,6 +161,9 @@
18 [ -z "$DIRECTORY" ] && DIRECTORY=$NAME
19 [ ! -d "$DIRECTORY" ] && mkdir -p "$DIRECTORY"
20
21+[ -n "$DEFAULT_ADDRESS" ] ||
22+ { echo "failed to get address of virbr0"; exit 1; }
23+
24 # Extract the needed files from the ISO image.
25 DISK_INFO="/.disk/info"
26 INITRD='*/initrd.*'

Subscribers

People subscribed via source and target branches

to all changes: