Merge lp:~tycho-s/maas/fix-1181334 into lp:~maas-committers/maas/trunk
Proposed by
Tycho Andersen
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Raphaël Badin | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 1740 | ||||
Proposed branch: | lp:~tycho-s/maas/fix-1181334 | ||||
Merge into: | lp:~maas-committers/maas/trunk | ||||
Diff against target: |
168 lines (+72/-14) 4 files modified
src/maasserver/api.py (+21/-14) src/maasserver/models/bootimage.py (+10/-0) src/maasserver/models/tests/test_bootimage.py (+30/-0) src/maasserver/tests/test_api_pxeconfig.py (+11/-0) |
||||
To merge this branch: | bzr merge lp:~tycho-s/maas/fix-1181334 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Julian Edwards (community) | Approve | ||
Review via email: mp+195132@code.launchpad.net |
Commit message
Use existing image instead of defaulting to i386
Fixes bug #1181334
Description of the change
Use existing image instead of defaulting to i386
Fixes bug #1181334
To post a comment you must log in.
Thanks for the fix Tycho. It's got a bug though!
26 + images = BootImage. objects. filter( release= series)
This will not restrict images by nodegroup. Remember that each nodegroup (cluster) has its own set of images.
It would be better if you added a new, tested, BootImagesManager method so it's widely available. Something like:
get_ default_ arch_image_ in_nodegroup( self, nodegroup, series, purpose): objects. filter( release= series, nodegroup= nodegroup, purpose=purpose)
"""Return the first image available for any architecture in the nodegroup/series supplied."""
images = BootImage.
return get_one(images)
You need to test that:
* it returns None if no images are available
* it returns the only image if only one image is available
* it returns the first image if multiple images are available
As an aside, pxeconfig is far too big already and needs better unit tests, but we'll leave that for another day...
Cheers.