Merge lp:~jtv/maas/use-main-archive-for-intel-arches into lp:~maas-committers/maas/trunk

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 2278
Proposed branch: lp:~jtv/maas/use-main-archive-for-intel-arches
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 116 lines (+68/-1)
4 files modified
contrib/preseeds_v2/curtin_userdata (+1/-1)
src/maasserver/models/node.py (+5/-0)
src/maasserver/models/tests/test_node.py (+7/-0)
src/maasserver/tests/test_preseed.py (+55/-0)
To merge this branch: bzr merge lp:~jtv/maas/use-main-archive-for-intel-arches
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+216582@code.launchpad.net

Commit message

Address one of several problems reported in bug 1310076: Curtin userdata should use the main archive for all i386/amd64 architectures, not just for the ‘generic’ ones. It was accidentally using the ports archive for HWE kernels.

Description of the change

This is not enough to fix bug 1310076, but it addresses one of the problems reported there.

Jeroen

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

[0]

src/maasserver/tests/test_preseed.py

63 + :param main_arch: A main architecture, such as `i386` or `armhf`. A
64 + subarchitecture will be made up.

Why is is called *main*_arch?

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

Btw, this partially fixes what I think is a critical bug so I suggest you backport this to 1.5.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

> 63 + :param main_arch: A main architecture, such as `i386` or
> `armhf`. A
> 64 + subarchitecture will be made up.
>
> Why is is called *main*_arch?

To distinguish it from the full combination of main architecture and subarchitecture — which we also call "arch."

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (2.7 MiB)

The attempt to merge lp:~jtv/maas/use-main-archive-for-intel-arches into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Hit http://security.ubuntu.com trusty-security Release.gpg
Hit http://security.ubuntu.com trusty-security Release
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Hit http://nova.clouds.archive.ubuntu.com trusty-updates Release
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Ign http://security.ubuntu.com trusty-security/main Translation-en_US
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://security.ubuntu.com trusty-security/universe Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en_US
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 bind9 bind9utils build-essential bzr-builddeb curl daemontools debhelper dh-apport distro-info dnsutils firefox freeipmi-tools ipython isc-dhcp-common libjs-raphael libjs-yui3-full libjs-yui3-min libpq-dev make postgresql python-amqplib python-bzrlib python-celery python-convoy python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-formencode python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-netaddr python-netifaces python-oauth python-oops python-oops-amqp python-oops-datedir-repo python-oops-twisted python-...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (2.7 MiB)

The attempt to merge lp:~jtv/maas/use-main-archive-for-intel-arches into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [58.5 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [58.5 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [970 B]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [14 B]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [977 B]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [14 B]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://security.ubuntu.com trusty-security/main Translation-en_US
Ign http://security.ubuntu.com trusty-security/universe Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [3,405 B]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [648 B]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [10.1 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [1,602 B]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en_US
Fetched 137 kB in 0s (785 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 bind9 bind9utils build-essential bzr-builddeb curl daemontools debhelper dh-apport distro-info dnsutils firefox freeipmi-tools ipython isc-dhcp-common libjs-raphael libjs-yui3-full libjs-yui3-min libpq-dev make postgresql python-amqplib python-bzrlib python-celery python-convoy python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-formencode python-httplib2 python-jinja2 python-js...

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The test failures were a bug in a Django update. I landed a workaround in MAAS, so we can land branches again!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'contrib/preseeds_v2/curtin_userdata'
2--- contrib/preseeds_v2/curtin_userdata 2014-04-15 14:56:09 +0000
3+++ contrib/preseeds_v2/curtin_userdata 2014-04-21 11:47:42 +0000
4@@ -28,7 +28,7 @@
5 power_state:
6 mode: reboot
7
8-{{if node.architecture in {'i386/generic', 'amd64/generic'} }}
9+{{if node.split_arch()[0] in {'i386', 'amd64'} }}
10 apt_mirrors:
11 ubuntu_archive: http://{{main_archive_hostname}}/{{main_archive_directory}}
12 ubuntu_security: http://{{main_archive_hostname}}/{{main_archive_directory}}
13
14=== modified file 'src/maasserver/models/node.py'
15--- src/maasserver/models/node.py 2014-04-03 15:49:39 +0000
16+++ src/maasserver/models/node.py 2014-04-21 11:47:42 +0000
17@@ -899,3 +899,8 @@
18 "expression. This expression must instead be updated to set "
19 "this node to install with the fast installer.")
20 self.tags.add(uti_tag)
21+
22+ def split_arch(self):
23+ """Return architecture and subarchitecture, as a tuple."""
24+ arch, subarch = self.architecture.split('/')
25+ return (arch, subarch)
26
27=== modified file 'src/maasserver/models/tests/test_node.py'
28--- src/maasserver/models/tests/test_node.py 2014-04-03 12:54:58 +0000
29+++ src/maasserver/models/tests/test_node.py 2014-04-21 11:47:42 +0000
30@@ -870,6 +870,13 @@
31 "The use-fastpath-installer tag is defined with an expression",
32 unicode(error))
33
34+ def test_split_arch_returns_arch_as_tuple(self):
35+ main_arch = factory.make_name('arch')
36+ sub_arch = factory.make_name('subarch')
37+ full_arch = '%s/%s' % (main_arch, sub_arch)
38+ node = factory.make_node(architecture=full_arch)
39+ self.assertEqual((main_arch, sub_arch), node.split_arch())
40+
41
42 class NodeRoutersTest(MAASServerTestCase):
43
44
45=== modified file 'src/maasserver/tests/test_preseed.py'
46--- src/maasserver/tests/test_preseed.py 2014-04-10 13:50:25 +0000
47+++ src/maasserver/tests/test_preseed.py 2014-04-21 11:47:42 +0000
48@@ -62,6 +62,7 @@
49 AllMatch,
50 Contains,
51 ContainsAll,
52+ HasLength,
53 IsInstance,
54 MatchesAll,
55 Not,
56@@ -614,6 +615,60 @@
57 ]
58 ))
59
60+ def make_fastpath_node(self, main_arch=None):
61+ """Return a `Node`, with FPI enabled, and the given main architecture.
62+
63+ :param main_arch: A main architecture, such as `i386` or `armhf`. A
64+ subarchitecture will be made up.
65+ """
66+ if main_arch is None:
67+ main_arch = factory.make_name('arch')
68+ arch = '%s/%s' % (main_arch, factory.make_name('subarch'))
69+ node = factory.make_node(architecture=arch)
70+ node.use_fastpath_installer()
71+ return node
72+
73+ def extract_archive_setting(self, userdata):
74+ """Extract the `ubuntu_archive` setting from `userdata`."""
75+ userdata_lines = []
76+ for line in userdata.splitlines():
77+ line = line.strip()
78+ if line.startswith('ubuntu_archive'):
79+ userdata_lines.append(line)
80+ self.assertThat(userdata_lines, HasLength(1))
81+ [userdata_line] = userdata_lines
82+ key, value = userdata_line.split(':', 1)
83+ return value.strip()
84+
85+ def summarise_url(self, url):
86+ """Return just the hostname and path from `url`, normalised."""
87+ # This is needed because the userdata deliberately makes some minor
88+ # changes to the archive URLs, making it harder to recognise which
89+ # archive they use: slashes are added, schemes are hard-coded.
90+ parsed_result = urlparse(url)
91+ return parsed_result.netloc, parsed_result.path.strip('/')
92+
93+ def test_get_curtin_config_uses_main_archive_for_i386(self):
94+ node = self.make_fastpath_node('i386')
95+ userdata = get_curtin_config(node)
96+ self.assertEqual(
97+ self.summarise_url(Config.objects.get_config('main_archive')),
98+ self.summarise_url(self.extract_archive_setting(userdata)))
99+
100+ def test_get_curtin_config_uses_main_archive_for_amd64(self):
101+ node = self.make_fastpath_node('amd64')
102+ userdata = get_curtin_config(node)
103+ self.assertEqual(
104+ self.summarise_url(Config.objects.get_config('main_archive')),
105+ self.summarise_url(self.extract_archive_setting(userdata)))
106+
107+ def test_get_curtin_config_uses_ports_archive_for_other_arch(self):
108+ node = self.make_fastpath_node()
109+ userdata = get_curtin_config(node)
110+ self.assertEqual(
111+ self.summarise_url(Config.objects.get_config('ports_archive')),
112+ self.summarise_url(self.extract_archive_setting(userdata)))
113+
114 def test_get_curtin_context(self):
115 node = factory.make_node()
116 node.use_fastpath_installer()