Merge lp:~rvb/maas-test/only-trusty into lp:maas-test

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: 147
Merged at revision: 143
Proposed branch: lp:~rvb/maas-test/only-trusty
Merge into: lp:maas-test
Diff against target: 97 lines (+38/-10)
3 files modified
maastest/parser.py (+3/-3)
maastest/tests/test_utils.py (+10/-4)
maastest/utils.py (+25/-3)
To merge this branch: bzr merge lp:~rvb/maas-test/only-trusty
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+214312@code.launchpad.net

Commit message

Limit the list of series on which to install MAAS to Trusty.

Description of the change

maas-test can only install MAAS on Trusty now. This is a consequence of the way bug 1301815 was fixed (see https://code.launchpad.net/~jtv/maas-test/no-import-ephemerals/+merge/213958).

Right now the parameter is a bit useless (the default is the only valid value for --maas-series) but I decided to keep the parameter as it will be useful in the future.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Thanks for making this change. I think it's fine, but I do have a query in [2].

[1]

11 + default=utils.get_supported_maas_series()[0],

Unexplained indexes like this are a red flag. I think it would be better to just hard-code "trusty" here.

[2]

71 + These are the series that MAAS can deploy on the nodes
72 + it manages.
73 + """
74 + return _get_supported_series('precise')

Why is trusty not included here?

review: Needs Information
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Oh as soon as I press the damn button I see why... the structure of the code confused me a bit so I'll approve now with a suggestion:

74 + return _get_supported_series('precise')

83 + return _get_supported_series('trusty')

Please add a comment above both of these that says "Return all series above and including .... XXX"

Thank you :)

review: Approve
lp:~rvb/maas-test/only-trusty updated
147. By Raphaël Badin

Add comments.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maastest/parser.py'
2--- maastest/parser.py 2014-03-21 16:21:22 +0000
3+++ maastest/parser.py 2014-04-08 06:49:33 +0000
4@@ -108,8 +108,8 @@
5 # VM details.
6 parser.add_argument(
7 '--maas-series', type=text_type,
8- choices=utils.get_supported_series(),
9- default=latest_released_series,
10+ choices=utils.get_supported_maas_series(),
11+ default=utils.get_supported_maas_series()[0],
12 help="Code name for the Ubuntu release series to install on the "
13 "virtual machine (where the MAAS server will be installed). "
14 "Defaults to the latest stable Ubuntu series (%(default)s).")
15@@ -126,7 +126,7 @@
16 # MAAS images.
17 parser.add_argument(
18 '--series', type=text_type,
19- choices=utils.get_supported_series(),
20+ choices=utils.get_supported_node_series(),
21 default=latest_LTS_series,
22 help="Code name for the Ubuntu release series that the node should "
23 "run. Defaults to the latest LTS (%(default)s).")
24
25=== modified file 'maastest/tests/test_utils.py'
26--- maastest/tests/test_utils.py 2014-03-03 04:27:57 +0000
27+++ maastest/tests/test_utils.py 2014-04-08 06:49:33 +0000
28@@ -251,9 +251,9 @@
29 self.assertEqual(series, utils.determine_vm_series())
30
31
32-class TestGetSupportedSeries(testtools.TestCase):
33+class TestGetSupportedNodeSeries(testtools.TestCase):
34
35- def test_get_supported_series_return_series(self):
36+ def test_get_supported_node_series_return_series(self):
37 supported = (
38 distro_info.UbuntuDistroInfo().supported(result="codename"))
39 # The list of supported series will evolve in time. At the time
40@@ -261,9 +261,15 @@
41 # not supported by MAAS.
42 if 'lucid' in supported:
43 supported.remove('lucid')
44- self.assertEqual(supported, utils.get_supported_series())
45+ self.assertEqual(supported, utils.get_supported_node_series())
46 else:
47- self.assertEqual(supported, utils.get_supported_series())
48+ self.assertEqual(supported, utils.get_supported_node_series())
49+
50+
51+class TestGetSupportedMAASSeries(testtools.TestCase):
52+
53+ def test_get_supported_maas_series_return_series(self):
54+ self.assertEqual(['trusty'], utils.get_supported_maas_series())
55
56
57 class TestExtractMAPIPMapping(testtools.TestCase):
58
59=== modified file 'maastest/utils.py'
60--- maastest/utils.py 2014-03-03 04:27:57 +0000
61+++ maastest/utils.py 2014-04-08 06:49:33 +0000
62@@ -159,12 +159,34 @@
63 return series
64
65
66-def get_supported_series():
67- """List of MAAS-supported Ubuntu series."""
68+def get_supported_node_series():
69+ """List of MAAS-supported Ubuntu series.
70+
71+ These are the series that MAAS can deploy on the nodes
72+ it manages.
73+ """
74+ # Return all series above and including Precise.
75+ return _get_supported_series('precise')
76+
77+
78+def get_supported_maas_series():
79+ """List of Ubuntu series for MAAS.
80+
81+ These are the series on which maas-test can install a
82+ a MAAS instance.
83+ """
84+ # Return all series above and including Trusty.
85+ return _get_supported_series('trusty')
86+
87+
88+def _get_supported_series(cut_off_series):
89+ """Return the list of supported series, starting from the given
90+ `cut_off_series`.
91+ """
92 udi = distro_info.UbuntuDistroInfo()
93 supported = udi.supported(result="codename")
94 cut_off_index = (
95- supported.index('precise') if 'precise' in supported else 0)
96+ supported.index(cut_off_series) if cut_off_series in supported else 0)
97 return supported[cut_off_index:]
98
99

Subscribers

People subscribed via source and target branches