Merge lp:~blake-rouse/maas/fix-1353597-1.6 into lp:maas/1.6

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: 2543
Merged at revision: 2542
Proposed branch: lp:~blake-rouse/maas/fix-1353597-1.6
Merge into: lp:maas/1.6
Diff against target: 36 lines (+14/-1)
2 files modified
src/provisioningserver/boot/powernv.py (+1/-1)
src/provisioningserver/boot/tests/test_powernv.py (+13/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1353597-1.6
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+229856@code.launchpad.net

Commit message

Forces the mac address in format_bootif to lower.

To post a comment you must log in.
Blake Rouse (blake-rouse) wrote :

Self-approving backport.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/boot/powernv.py'
2--- src/provisioningserver/boot/powernv.py 2014-06-20 16:26:31 +0000
3+++ src/provisioningserver/boot/powernv.py 2014-08-06 19:52:35 +0000
4@@ -61,7 +61,7 @@
5 """Formats a mac address into the BOOTIF format, expected by
6 the linux kernel."""
7 mac = mac.replace(':', '-')
8- mac = mac.upper()
9+ mac = mac.lower()
10 return '%02x-%s' % (ARP_HTYPE.ETHERNET, mac)
11
12
13
14=== modified file 'src/provisioningserver/boot/tests/test_powernv.py'
15--- src/provisioningserver/boot/tests/test_powernv.py 2014-06-20 16:39:15 +0000
16+++ src/provisioningserver/boot/tests/test_powernv.py 2014-08-06 19:52:35 +0000
17@@ -232,6 +232,19 @@
18 expected = 'BOOTIF=%s' % format_bootif(fake_mac)
19 self.assertIn(expected, config['execute']['APPEND'])
20
21+ def test_format_bootif_replaces_colon(self):
22+ fake_mac = factory.getRandomMACAddress()
23+ self.assertEqual(
24+ '01-%s' % fake_mac.replace(':', '-').lower(),
25+ format_bootif(fake_mac))
26+
27+ def test_format_bootif_makes_mac_address_lower(self):
28+ fake_mac = factory.getRandomMACAddress()
29+ fake_mac = fake_mac.upper()
30+ self.assertEqual(
31+ '01-%s' % fake_mac.replace(':', '-').lower(),
32+ format_bootif(fake_mac))
33+
34
35 class TestPowerNVBootMethodPathPrefix(MAASTestCase):
36 """Tests for

Subscribers

People subscribed via source and target branches

to all changes: