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
=== modified file 'contrib/preseeds_v2/curtin_userdata'
--- contrib/preseeds_v2/curtin_userdata 2014-04-15 14:56:09 +0000
+++ contrib/preseeds_v2/curtin_userdata 2014-04-21 11:47:42 +0000
@@ -28,7 +28,7 @@
28power_state:28power_state:
29 mode: reboot29 mode: reboot
3030
31{{if node.architecture in {'i386/generic', 'amd64/generic'} }}31{{if node.split_arch()[0] in {'i386', 'amd64'} }}
32apt_mirrors:32apt_mirrors:
33 ubuntu_archive: http://{{main_archive_hostname}}/{{main_archive_directory}}33 ubuntu_archive: http://{{main_archive_hostname}}/{{main_archive_directory}}
34 ubuntu_security: http://{{main_archive_hostname}}/{{main_archive_directory}}34 ubuntu_security: http://{{main_archive_hostname}}/{{main_archive_directory}}
3535
=== modified file 'src/maasserver/models/node.py'
--- src/maasserver/models/node.py 2014-04-03 15:49:39 +0000
+++ src/maasserver/models/node.py 2014-04-21 11:47:42 +0000
@@ -899,3 +899,8 @@
899 "expression. This expression must instead be updated to set "899 "expression. This expression must instead be updated to set "
900 "this node to install with the fast installer.")900 "this node to install with the fast installer.")
901 self.tags.add(uti_tag)901 self.tags.add(uti_tag)
902
903 def split_arch(self):
904 """Return architecture and subarchitecture, as a tuple."""
905 arch, subarch = self.architecture.split('/')
906 return (arch, subarch)
902907
=== modified file 'src/maasserver/models/tests/test_node.py'
--- src/maasserver/models/tests/test_node.py 2014-04-03 12:54:58 +0000
+++ src/maasserver/models/tests/test_node.py 2014-04-21 11:47:42 +0000
@@ -870,6 +870,13 @@
870 "The use-fastpath-installer tag is defined with an expression",870 "The use-fastpath-installer tag is defined with an expression",
871 unicode(error))871 unicode(error))
872872
873 def test_split_arch_returns_arch_as_tuple(self):
874 main_arch = factory.make_name('arch')
875 sub_arch = factory.make_name('subarch')
876 full_arch = '%s/%s' % (main_arch, sub_arch)
877 node = factory.make_node(architecture=full_arch)
878 self.assertEqual((main_arch, sub_arch), node.split_arch())
879
873880
874class NodeRoutersTest(MAASServerTestCase):881class NodeRoutersTest(MAASServerTestCase):
875882
876883
=== modified file 'src/maasserver/tests/test_preseed.py'
--- src/maasserver/tests/test_preseed.py 2014-04-10 13:50:25 +0000
+++ src/maasserver/tests/test_preseed.py 2014-04-21 11:47:42 +0000
@@ -62,6 +62,7 @@
62 AllMatch,62 AllMatch,
63 Contains,63 Contains,
64 ContainsAll,64 ContainsAll,
65 HasLength,
65 IsInstance,66 IsInstance,
66 MatchesAll,67 MatchesAll,
67 Not,68 Not,
@@ -614,6 +615,60 @@
614 ]615 ]
615 ))616 ))
616617
618 def make_fastpath_node(self, main_arch=None):
619 """Return a `Node`, with FPI enabled, and the given main architecture.
620
621 :param main_arch: A main architecture, such as `i386` or `armhf`. A
622 subarchitecture will be made up.
623 """
624 if main_arch is None:
625 main_arch = factory.make_name('arch')
626 arch = '%s/%s' % (main_arch, factory.make_name('subarch'))
627 node = factory.make_node(architecture=arch)
628 node.use_fastpath_installer()
629 return node
630
631 def extract_archive_setting(self, userdata):
632 """Extract the `ubuntu_archive` setting from `userdata`."""
633 userdata_lines = []
634 for line in userdata.splitlines():
635 line = line.strip()
636 if line.startswith('ubuntu_archive'):
637 userdata_lines.append(line)
638 self.assertThat(userdata_lines, HasLength(1))
639 [userdata_line] = userdata_lines
640 key, value = userdata_line.split(':', 1)
641 return value.strip()
642
643 def summarise_url(self, url):
644 """Return just the hostname and path from `url`, normalised."""
645 # This is needed because the userdata deliberately makes some minor
646 # changes to the archive URLs, making it harder to recognise which
647 # archive they use: slashes are added, schemes are hard-coded.
648 parsed_result = urlparse(url)
649 return parsed_result.netloc, parsed_result.path.strip('/')
650
651 def test_get_curtin_config_uses_main_archive_for_i386(self):
652 node = self.make_fastpath_node('i386')
653 userdata = get_curtin_config(node)
654 self.assertEqual(
655 self.summarise_url(Config.objects.get_config('main_archive')),
656 self.summarise_url(self.extract_archive_setting(userdata)))
657
658 def test_get_curtin_config_uses_main_archive_for_amd64(self):
659 node = self.make_fastpath_node('amd64')
660 userdata = get_curtin_config(node)
661 self.assertEqual(
662 self.summarise_url(Config.objects.get_config('main_archive')),
663 self.summarise_url(self.extract_archive_setting(userdata)))
664
665 def test_get_curtin_config_uses_ports_archive_for_other_arch(self):
666 node = self.make_fastpath_node()
667 userdata = get_curtin_config(node)
668 self.assertEqual(
669 self.summarise_url(Config.objects.get_config('ports_archive')),
670 self.summarise_url(self.extract_archive_setting(userdata)))
671
617 def test_get_curtin_context(self):672 def test_get_curtin_context(self):
618 node = factory.make_node()673 node = factory.make_node()
619 node.use_fastpath_installer()674 node.use_fastpath_installer()