Merge lp:~jtv/maas/1.5-bug-1302772 into lp:maas/1.5

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 2228
Proposed branch: lp:~jtv/maas/1.5-bug-1302772
Merge into: lp:maas/1.5
Diff against target: 94 lines (+59/-0)
2 files modified
src/provisioningserver/config.py (+23/-0)
src/provisioningserver/tests/test_config.py (+36/-0)
To merge this branch: bzr merge lp:~jtv/maas/1.5-bug-1302772
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Andres Rodriguez Pending
Review via email: mp+214557@code.launchpad.net

This proposal supersedes a proposal from 2014-04-07.

Commit message

Backport trunk r2235: Continue to accept (but do not use) the old “boot” section in pserv.yaml. Otherwise, upgrade breaks while parsing this file.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote : Posted in a previous version of this proposal

There are conflicts in the branch

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

Self-approving straight backport. The conflicts earlier happened because somehow the MP was targeted at trunk instead of 1.5. I have no idea why — I definitely went through the motions to select 1.5, finding it with a search and then selecting it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/config.py'
2--- src/provisioningserver/config.py 2014-03-28 06:51:59 +0000
3+++ src/provisioningserver/config.py 2014-04-07 14:44:05 +0000
4@@ -128,6 +128,28 @@
5 generator = String(if_missing=b"http://localhost/MAAS/api/1.0/pxeconfig/")
6
7
8+class ConfigLegacyEphemeral(Schema):
9+ """Legacy `eephemeral` section in `pserv.yaml` prior to MAAS 1.5.
10+
11+ This has been replaced with boot-source selection in `bootresources.yaml`.
12+ It is still accepted in `pserv.yaml`, but not used.
13+ """
14+ if_key_missing = None
15+ images_directory = String(if_missing=None)
16+ releases = Set(if_missing=None)
17+
18+
19+class ConfigLegacyBoot(Schema):
20+ """Legacy `boot` section in `pserv.yaml` prior to MAAS 1.5.
21+
22+ The new version of this config section lives in `bootresources.yaml`. It
23+ is still accepted in `pserv.yaml`, but not used.
24+ """
25+ if_key_missing = None
26+ architectures = Set(if_missing=None)
27+ ephemeral = ConfigLegacyEphemeral
28+
29+
30 class ConfigRPC(Schema):
31 """Configuration validator for the RPC service."""
32
33@@ -307,6 +329,7 @@
34 broker = ConfigBroker
35 tftp = ConfigTFTP
36 rpc = ConfigRPC
37+ boot = ConfigLegacyBoot
38
39
40 class BootConfig(ConfigBase):
41
42=== modified file 'src/provisioningserver/tests/test_config.py'
43--- src/provisioningserver/tests/test_config.py 2014-03-28 16:47:54 +0000
44+++ src/provisioningserver/tests/test_config.py 2014-04-07 14:44:05 +0000
45@@ -354,6 +354,14 @@
46 'root': "/var/lib/maas/tftp",
47 'resource_root': "/var/lib/maas/boot-resources/current/",
48 },
49+ # Legacy section. Became unused in MAAS 1.5.
50+ 'boot': {
51+ 'architectures': None,
52+ 'ephemeral': {
53+ 'images_directory': None,
54+ 'releases': None,
55+ },
56+ },
57 }
58
59 default_development_config = deepcopy(default_production_config)
60@@ -387,6 +395,34 @@
61 partial(Config.parse, config),
62 Raises(expected))
63
64+ def test_accepts_1_4_config_file(self):
65+ # A config file that was valid with MAAS 1.4 still loads, even though
66+ # its "boot" section is no longer used.
67+ broker_password = factory.make_name('pass')
68+ config = Config.parse(dedent("""\
69+ logfile: "/dev/null"
70+ oops:
71+ directory: "logs/oops"
72+ reporter: "maas-pserv"
73+ broker:
74+ host: "localhost"
75+ port: 5673
76+ username: brokeruser
77+ password: "%s"
78+ vhost: "/"
79+ tftp:
80+ root: /var/lib/maas/tftp
81+ port: 5244
82+ generator: http://localhost:5243/api/1.0/pxeconfig/
83+ boot:
84+ architectures: ['i386', 'armhf']
85+ ephemeral:
86+ images_directory: /var/lib/maas/ephemeral
87+ releases: ['precise', 'saucy']
88+ """) % broker_password)
89+ # This does not fail.
90+ self.assertEqual(broker_password, config['broker']['password'])
91+
92
93 class TestBootConfig(MAASTestCase):
94 """Tests for `provisioningserver.config.BootConfig`."""

Subscribers

People subscribed via source and target branches

to all changes: