Merge lp:~blake-rouse/maas/fix-bug-1300285 into lp:~maas-committers/maas/trunk
Proposed by
Blake Rouse
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Blake Rouse | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2216 | ||||
Proposed branch: | lp:~blake-rouse/maas/fix-bug-1300285 | ||||
Merge into: | lp:~maas-committers/maas/trunk | ||||
Diff against target: |
60 lines (+26/-6) 2 files modified
src/provisioningserver/dhcp/config.py (+21/-4) src/provisioningserver/dhcp/tests/test_config.py (+5/-2) |
||||
To merge this branch: | bzr merge lp:~blake-rouse/maas/fix-bug-1300285 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+213499@code.launchpad.net |
Commit message
Resolves issue where if a node does not provide an architecture type on dhcp request, or no other boot method is available for that architecture, the node still uses pxelinux.0 to boot.
Description of the change
[bug=1300285] Fixes generate-
To post a comment you must log in.
I think I understand what this does now, but the commit message is a bit cryptic. It summarises the code changes, but it doesn't give me much of a high-level idea of what the change means. It's that intention that's essential for review and maintenance. Could you perhaps say something like "make the PXE bootloader the default bootloader in the DHCP config, for when the node does not specify its architecture"? The extra sentence you provide in the description but not in the commit message is actually much more suitable for the commit message.
Also, there is no need to duplicate anything between the commit message and the description. The description is for the merge proposal only, and should help facilitate review. The commit message goes into revision history, with automatically added tags for author, reviewer, and bug number. Which also means: no need to prefix the bug yourself!
Typos in config.py: "sepcial" and, in that same comment, missing punctuation. Could you be a bit more descriptive? Someone reading this code and encountering "the special case PXEBootLoader" may still have trouble finding what that refers to. Are there several PXEBootLoaders, and is one of them a special case? Or do you mean that the PXEBootLoader is a special case?
In compose_ conditional_ bootloader, the loop structure and the code after the loop are now connected through the pxe_method variable, and through the "continue" statement in the loop. Those are often things worth avoiding, because it will take future maintainers time to figure out and preserve the intended behaviour. Not much, but it adds up — and what's more, they may not be aware of the need.
So might I suggest removing the "continue" and moving the variable closer to its point of use:
for name, method in BootMethodRegistry: BOOTLOADER. format(
behaviour= next(behaviour) , arch_octet= method. arch_octet,
bootloader= method. bootloader_ path).strip( ) + ' '
# PXEBootMethod is special. No matter what the arch_octet is,
# it's always the last in the conditional, with an else. So
# no matter the architecture it will always try to use pxelinux
# to boot that node.
if name != "pxe":
output += CONDITIONAL_
# Now put the PXE bootloader at the end. try.get_ item('pxe' ) format(
bootloader =pxe_method. bootloader_ path).strip( )
pxe_method = BootMethodRegis
if pxe_method is not None:
output += PXE_BOOTLOADER.
(Also note that the "is its" in the comment could do with a comma.)
Alternatively, is it actually a problem to mention the PXE bootloader twice? If not, maybe repetition isn't so bad. That would give us something like:
for name, method in BootMethodRegistry: BOOTLOADER. format(
behaviour= next(behaviour) , arch_octet= method. arch_octet,
bootloader =method. bootloader_ path).strip( ) + ' '
output += CONDITIONAL_
# Fall back on the PXE bootloader if architecture is unknown. try.get_ item('pxe' ) format(
bootloader =pxe_method. bootloader_ path).strip( )
pxe_method = BootMethodRegis
if pxe_method is not None:
output += PXE_BOOTLOADER.
I...