Merge lp:~rodsmith/maas-cert-server/fix-i386-detection into lp:~hardware-certification/maas-cert-server/trunk

Proposed by Rod Smith
Status: Merged
Approved by: Jeff Lane 
Approved revision: 67
Merged at revision: 68
Proposed branch: lp:~rodsmith/maas-cert-server/fix-i386-detection
Merge into: lp:~hardware-certification/maas-cert-server/trunk
Diff against target: 71 lines (+37/-2)
2 files modified
debian/changelog (+7/-0)
usr/sbin/maniacs-setup (+30/-2)
To merge this branch: bzr merge lp:~rodsmith/maas-cert-server/fix-i386-detection
Reviewer Review Type Date Requested Status
Jeff Lane  Approve
Review via email: mp+311087@code.launchpad.net

Description of the change

This is not-quite-a-fix for bug #1641971 (using maniacs-setup fails to import i386 images by default under MAAS 2.1, resulting in error messages). Instead of addressing the issue head-on, this version returns the script to the behavior it had in the past (with MAAS 2.0): It imports i386 custom images if and only if standard MAAS i386 images already exist on the server. The error messages seem to be a result of pxelinux being split out into its own unique image in MAAS 2.1, which was not the case with MAAS 2.0. This results in the need for a more complex test to see if an i386 image is loaded. Note that, because this doesn't precisely address the issues in bug #1641971, I have not marked this as a fix for that bug.

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

Cool.

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 2016-10-17 17:49:31 +0000
3+++ debian/changelog 2016-11-16 22:07:52 +0000
4@@ -1,3 +1,10 @@
5+maas-cert-server (0.2.26-0ppa1) xenial; urgency=medium
6+
7+ * Fixed detection of i386 images for custom-image download
8+ feature under MAAS 2.1.
9+
10+ -- Rod Smith <rod.smith@canonical.com> Wed, 16 Nov 2016 16:57:33 -0500
11+
12 maas-cert-server (0.2.25-0ppa1) xenial; urgency=medium
13
14 * Fixed typo in prompt in maniacs-setup: "virtualization" was spelled
15
16=== modified file 'usr/sbin/maniacs-setup'
17--- usr/sbin/maniacs-setup 2016-09-13 18:57:24 +0000
18+++ usr/sbin/maniacs-setup 2016-11-16 22:07:52 +0000
19@@ -861,6 +861,34 @@
20 }
21
22
23+# Determine if any i386 images are loaded on the MAAS server.
24+# Sets $is_i386 to "N" if no i386 images are found, "Y" if they are.
25+is_i386_loaded() {
26+ is_i386="N"
27+ local resources=`maas admin boot-resources read`
28+ # Look for evidence of i386 installation. Note that the below can produce
29+ # false positives, so we do more shortly....
30+ local maybe_i386=`echo $resources | jshon -a -e architecture | grep i386`
31+ if [ ! -z "$maybe_i386" ] ; then
32+ local num_entries=`echo $resources | jshon -l`
33+ let last_entry=$num_entries-1
34+ for entry in `seq 0 $last_entry`; do
35+ one_entry=`echo $resources | jshon -e $entry`
36+ local found_possible_i386=`echo $one_entry | grep i386`
37+ if [ ! -z "$found_possible_i386" ] ; then
38+ local is_pxelinux=`echo "$one_entry" | jshon -e name | grep pxelinux`
39+ # False positive can result from pxelinux entry, which is why
40+ # we filter it out. AFAIK, any other "i386" in "name" field is
41+ # a legitimate i386 image.
42+ if [ -z "$is_pxelinux" ] ; then
43+ is_i386="Y"
44+ fi
45+ fi
46+ done
47+ fi
48+} # is_i386_loaded()
49+
50+
51 setup_point_releases() {
52 echo
53 echo "***************************************************************************"
54@@ -872,7 +900,7 @@
55 local versions=`wget -O - $FIXED_POINT_URL 2> /dev/null | grep ubuntu.*gz | sed "s/.*ubuntu-//" | sed "s/-server-.*//" | uniq | sort -r`
56 local old_series=""
57 local default_release=""
58- local is_i386=`maas admin boot-resources read | grep i386`
59+ is_i386_loaded
60 for release in ${versions[@]}; do
61 local series=`echo $release | cut -b 1-5`
62 if [ "$old_series" != "$series" ] ; then
63@@ -897,7 +925,7 @@
64 default_release=u"$release"_amd64
65 fi
66 load_point_release $release amd64 "$default_yn"
67- if [ ! -z "$is_i386" ] ; then
68+ if [ "$is_i386" = "Y" ] ; then
69 load_point_release $release i386 "$default_yn"
70 fi
71 fi

Subscribers

People subscribed via source and target branches

to status/vote changes: