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: 2226
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
=== modified file 'src/provisioningserver/config.py'
--- src/provisioningserver/config.py 2014-03-28 06:51:59 +0000
+++ src/provisioningserver/config.py 2014-04-07 14:44:05 +0000
@@ -128,6 +128,28 @@
128 generator = String(if_missing=b"http://localhost/MAAS/api/1.0/pxeconfig/")128 generator = String(if_missing=b"http://localhost/MAAS/api/1.0/pxeconfig/")
129129
130130
131class ConfigLegacyEphemeral(Schema):
132 """Legacy `eephemeral` section in `pserv.yaml` prior to MAAS 1.5.
133
134 This has been replaced with boot-source selection in `bootresources.yaml`.
135 It is still accepted in `pserv.yaml`, but not used.
136 """
137 if_key_missing = None
138 images_directory = String(if_missing=None)
139 releases = Set(if_missing=None)
140
141
142class ConfigLegacyBoot(Schema):
143 """Legacy `boot` section in `pserv.yaml` prior to MAAS 1.5.
144
145 The new version of this config section lives in `bootresources.yaml`. It
146 is still accepted in `pserv.yaml`, but not used.
147 """
148 if_key_missing = None
149 architectures = Set(if_missing=None)
150 ephemeral = ConfigLegacyEphemeral
151
152
131class ConfigRPC(Schema):153class ConfigRPC(Schema):
132 """Configuration validator for the RPC service."""154 """Configuration validator for the RPC service."""
133155
@@ -307,6 +329,7 @@
307 broker = ConfigBroker329 broker = ConfigBroker
308 tftp = ConfigTFTP330 tftp = ConfigTFTP
309 rpc = ConfigRPC331 rpc = ConfigRPC
332 boot = ConfigLegacyBoot
310333
311334
312class BootConfig(ConfigBase):335class BootConfig(ConfigBase):
313336
=== modified file 'src/provisioningserver/tests/test_config.py'
--- src/provisioningserver/tests/test_config.py 2014-03-28 16:47:54 +0000
+++ src/provisioningserver/tests/test_config.py 2014-04-07 14:44:05 +0000
@@ -354,6 +354,14 @@
354 'root': "/var/lib/maas/tftp",354 'root': "/var/lib/maas/tftp",
355 'resource_root': "/var/lib/maas/boot-resources/current/",355 'resource_root': "/var/lib/maas/boot-resources/current/",
356 },356 },
357 # Legacy section. Became unused in MAAS 1.5.
358 'boot': {
359 'architectures': None,
360 'ephemeral': {
361 'images_directory': None,
362 'releases': None,
363 },
364 },
357 }365 }
358366
359 default_development_config = deepcopy(default_production_config)367 default_development_config = deepcopy(default_production_config)
@@ -387,6 +395,34 @@
387 partial(Config.parse, config),395 partial(Config.parse, config),
388 Raises(expected))396 Raises(expected))
389397
398 def test_accepts_1_4_config_file(self):
399 # A config file that was valid with MAAS 1.4 still loads, even though
400 # its "boot" section is no longer used.
401 broker_password = factory.make_name('pass')
402 config = Config.parse(dedent("""\
403 logfile: "/dev/null"
404 oops:
405 directory: "logs/oops"
406 reporter: "maas-pserv"
407 broker:
408 host: "localhost"
409 port: 5673
410 username: brokeruser
411 password: "%s"
412 vhost: "/"
413 tftp:
414 root: /var/lib/maas/tftp
415 port: 5244
416 generator: http://localhost:5243/api/1.0/pxeconfig/
417 boot:
418 architectures: ['i386', 'armhf']
419 ephemeral:
420 images_directory: /var/lib/maas/ephemeral
421 releases: ['precise', 'saucy']
422 """) % broker_password)
423 # This does not fail.
424 self.assertEqual(broker_password, config['broker']['password'])
425
390426
391class TestBootConfig(MAASTestCase):427class TestBootConfig(MAASTestCase):
392 """Tests for `provisioningserver.config.BootConfig`."""428 """Tests for `provisioningserver.config.BootConfig`."""

Subscribers

People subscribed via source and target branches

to all changes: