MAC address for node's IPMI is reversed looked up to yield IP address using case sensitive comparison
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Julian Edwards | ||
maas (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
The comparison used in provisioningser
For a fix, I strongly recommend doing these things to make this more friendly:
1. Trim all whitespace from the supplied MAC address before comparison.
2. Trim all delimiters too - both on the supplied MAC address and from the output column of the "arp -n" it's being compared with.
3. Translate both the supplied MAC address and the "arp -n" column data to lowercase or uppercase for comparison or use a case-insensitive match in the "for" loop.
- DIFF -
diff /usr/lib/
46a47
> import re
824a826,827
> mac = mac.lower()
> mac = re.sub('[^0-9a-f]', '', mac)
829c832,833
< if len(columns) == 5 and columns[2] == mac:
---
> col = re.sub('[^0-9a-f]', '', columns[2])
> if len(columns) == 5 and col == mac:
Related branches
- Julian Edwards (community): Approve (trivial)
-
Diff: 30 lines (+9/-1)2 files modifiedsrc/provisioningserver/utils/network.py (+1/-1)
src/provisioningserver/utils/tests/test_network.py (+8/-0)
Changed in maas: | |
status: | Triaged → Fix Committed |
Changed in maas: | |
assignee: | nobody → Julian Edwards (julian-edwards) |
Changed in maas: | |
status: | Fix Committed → Fix Released |
OK the diff was useless, and I'm sorry. But I'm not a python weenie, nor do I do diffs everyday for bug reports. The code, which is trivial to someone who writes python all the time, is easy in any case. Thank you for playing.