Merge lp:~lamont/maas/xenial-has-released into lp:~maas-committers/maas/trunk

Proposed by LaMont Jones
Status: Rejected
Rejected by: Mike Pontillo
Proposed branch: lp:~lamont/maas/xenial-has-released
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 114 lines (+25/-23)
2 files modified
src/provisioningserver/drivers/osystem/tests/test_ubuntu.py (+10/-11)
src/provisioningserver/drivers/osystem/ubuntu.py (+15/-12)
To merge this branch: bzr merge lp:~lamont/maas/xenial-has-released
Reviewer Review Type Date Requested Status
Lee Trager (community) Needs Information
Andres Rodriguez (community) Disapprove
Review via email: mp+320739@code.launchpad.net

Commit message

Xenial has released. Drop the old code from before it did.

Description of the change

Xenial has released. Drop the old code from before it did.

To post a comment you must log in.
Revision history for this message
Lee Trager (ltrager) wrote :

Thanks for cleaning that up!

review: Approve
Revision history for this message
Andres Rodriguez (andreserl) wrote :

We are hardcoding this for a reason. This is to prevent that the next LTS release cause the same issues as it caused when Xenial was out.

review: Disapprove
Revision history for this message
LaMont Jones (lamont) wrote :

> We are hardcoding this for a reason. This is to prevent that the next LTS
> release cause the same issues as it caused when Xenial was out.

The code being removed literally says "if trusty is the current LTS, that's a lie, it's xenial" -- that situation will not reoccur for at least 26 years, and requires that we be silly enough to reuse both "trusty" and "xenial"....

If we want to keep the code, it should probably turn into something that says "use the current devel release if it's LTS" -- that would need a prod vs dev switch, but is very doable. (the new release gets added to distro-info shortly after it opens, and we'd just need to see that devel opened and that it's an LTS.)

Revision history for this message
LaMont Jones (lamont) wrote :

> > We are hardcoding this for a reason. This is to prevent that the next LTS
> > release cause the same issues as it caused when Xenial was out.
>
> The code being removed literally says "if trusty is the current LTS, that's a
> lie, it's xenial" -- that situation will not reoccur for at least 26 years,
> and requires that we be silly enough to reuse both "trusty" and "xenial"....
>
> If we want to keep the code, it should probably turn into something that says
> "use the current devel release if it's LTS" -- that would need a prod vs dev
> switch, but is very doable. (the new release gets added to distro-info shortly
> after it opens, and we'd just need to see that devel opened and that it's an
> LTS.)

Also, it's trivial for devs to override the LTS release name in the database. (Which I did for a while when I was using yakkety to test ipv6, because we had the packages there, but not in xenial yet.)

lp:~lamont/maas/xenial-has-released updated
5838. By LaMont Jones

Choose our LTS for commissioning based on a date which has an LTS we know we
support, since each LTS of Ubuntu has a potential for breaking MAAS (python
version changes, etc). (xenial release broke MAAS 1.x, and we expect that the
next LTS is likely to break MAAS 2.x.)

5839. By LaMont Jones

Do not support commissioning on a release if that release is no longer supported by Ubuntu.

Revision history for this message
Lee Trager (ltrager) wrote :

MAAS looks up what the latest LTS is using the DistroInfo library. This library contains a list of all released Ubuntu and Debian releases. For 2.0 we wanted to test Xenial as the default before it was released so I hard coded it in. This does not lock us to Xenial, it simply says if DistroInfo thinks the latest release is Trusty, use Xenial.

It looks like we're going to hardcode Xenial so even when 18.04 comes out Xenial will be used, I'm fine with that just two questions below.

review: Needs Information
Revision history for this message
LaMont Jones (lamont) wrote :

Ultimately, it's Andres' call, but I think it's a conscious decision on our part in the 18.04 cycle to say "yes, when it comes out, maas will support it", rather than blithely running our installed base into the crusher.

I think I do still need to rework it for that case, so that we can set maas_lts_date into the future, and have it not take effect until that date (that is, we look at the earlier date of "now" and "maas_lts_date".)

Andres?

Revision history for this message
Mike Pontillo (mpontillo) wrote :

I think the safest thing to do (and this is oversimplifying) is:

    return 'xenial';

Why? Because we have no way of knowing whether or not our commissioning scripts will work on any other LTS. They're only well-tested on Xenial. When the next LTS arrives, along with it will come a version of MAAS that has been tested with LTS-next. At which time we would re-test our commissioning scripts with LTS-next and change the hard-coded release.

When LTS-next arrives, current MAAS 2.2 users might break if we suddenly change commissioning to use LTS-next.

We should have a way to override this so that we can CI-test commissioning with development releases.

Unmerged revisions

5839. By LaMont Jones

Do not support commissioning on a release if that release is no longer supported by Ubuntu.

5838. By LaMont Jones

Choose our LTS for commissioning based on a date which has an LTS we know we
support, since each LTS of Ubuntu has a potential for breaking MAAS (python
version changes, etc). (xenial release broke MAAS 1.x, and we expect that the
next LTS is likely to break MAAS 2.x.)

5837. By LaMont Jones

Remove some dead code.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/drivers/osystem/tests/test_ubuntu.py'
2--- src/provisioningserver/drivers/osystem/tests/test_ubuntu.py 2016-07-06 05:37:58 +0000
3+++ src/provisioningserver/drivers/osystem/tests/test_ubuntu.py 2017-03-23 17:21:39 +0000
4@@ -13,18 +13,17 @@
5 from maastesting.factory import factory
6 from maastesting.testcase import MAASTestCase
7 from provisioningserver.drivers.osystem import BOOT_IMAGE_PURPOSE
8-from provisioningserver.drivers.osystem.ubuntu import UbuntuOS
9+from provisioningserver.drivers.osystem.ubuntu import (
10+ maas_lts_date,
11+ UbuntuOS,
12+)
13
14
15 class TestUbuntuOS(MAASTestCase):
16
17 def get_lts_release(self):
18- # XXX ltrager 2016-04-06 - python3-distro-info won't set the latest lts
19- # to Xenial until its been released. So we can start testing MAAS 2.0
20- # with Xenial by default override it here. Once Xenial is released this
21- # can be removed
22- # return UbuntuDistroInfo().lts()
23- return "xenial"
24+ # The LTS release is hardcoded for a version of maas by date.
25+ return UbuntuDistroInfo().lts(maas_lts_date)
26
27 def get_release_title(self, release):
28 info = UbuntuDistroInfo()
29@@ -53,8 +52,8 @@
30
31 def test_get_default_release(self):
32 osystem = UbuntuOS()
33- expected = osystem.get_default_release()
34- self.assertEqual(expected, self.get_lts_release())
35+ actual = osystem.get_default_release()
36+ self.assertEqual(actual, self.get_lts_release())
37
38 def test_get_supported_commissioning_releases(self):
39 self.patch_autospec(UbuntuDistroInfo, "is_lts").return_value = True
40@@ -111,8 +110,8 @@
41
42 def test_default_commissioning_release(self):
43 osystem = UbuntuOS()
44- expected = osystem.get_default_commissioning_release()
45- self.assertEqual(expected, self.get_lts_release())
46+ actual = osystem.get_default_commissioning_release()
47+ self.assertEqual(actual, self.get_lts_release())
48
49 def test_get_release_title(self):
50 osystem = UbuntuOS()
51
52=== modified file 'src/provisioningserver/drivers/osystem/ubuntu.py'
53--- src/provisioningserver/drivers/osystem/ubuntu.py 2016-07-06 05:37:58 +0000
54+++ src/provisioningserver/drivers/osystem/ubuntu.py 2017-03-23 17:21:39 +0000
55@@ -4,11 +4,13 @@
56 """Ubuntu Operating System."""
57
58 __all__ = [
59+ "maas_lts_date",
60 "UbuntuOS",
61 ]
62
63 import os
64
65+from datetime import date
66 from distro_info import UbuntuDistroInfo
67 from provisioningserver.config import ClusterConfiguration
68 from provisioningserver.drivers.osystem import (
69@@ -16,6 +18,9 @@
70 OperatingSystem,
71 )
72
73+# The last LTS maas 2.x supports for commissioning is xenial.
74+maas_lts_date = date(2016, 4, 30)
75+
76
77 class UbuntuOS(OperatingSystem):
78 """Ubuntu operating system."""
79@@ -42,15 +47,8 @@
80
81 def get_lts_release(self):
82 """Return the latest Ubuntu LTS release."""
83- lts_release = self.ubuntu_distro_info.lts()
84- # XXX ltrager 2016-04-06 - python3-distro-info won't set the latest lts
85- # to Xenial until its been released. So we can start testing MAAS 2.0
86- # with Xenial by default override it here. Once Xenial is released this
87- # can be removed
88- if lts_release == "trusty":
89- return "xenial"
90- else:
91- return lts_release
92+ lts_release = self.ubuntu_distro_info.lts(maas_lts_date)
93+ return lts_release
94
95 def get_default_release(self):
96 """Gets the default release to use when a release is not
97@@ -63,9 +61,14 @@
98 system that supports commissioning.
99 """
100 unsupported_releases = ['precise']
101- return [name for name in self.ubuntu_distro_info.supported()
102- if name not in unsupported_releases
103- if self.ubuntu_distro_info.is_lts(name)]
104+ # Return the list of still-supported lts releases that were supported
105+ # on maas_lts_date.
106+ return [
107+ name
108+ for name in self.ubuntu_distro_info.supported(maas_lts_date)
109+ if name not in unsupported_releases
110+ if self.ubuntu_distro_info.is_lts(name)
111+ if name in self.ubuntu_distro_info.supported()]
112
113 def get_default_commissioning_release(self):
114 """Gets the default commissioning release for Ubuntu. This only exists