Merge lp:~alai/maas/1.5-1353597 into lp:maas/1.5

Proposed by Ashley Lai on 2014-10-22
Status: Merged
Approved by: Blake Rouse on 2014-10-22
Approved revision: 2299
Merged at revision: 2299
Proposed branch: lp:~alai/maas/1.5-1353597
Merge into: lp:maas/1.5
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:~alai/maas/1.5-1353597
Reviewer Review Type Date Requested Status
Blake Rouse 2014-10-22 Approve on 2014-10-22
Review via email: mp+239245@code.launchpad.net

Description of the change

Forces the mac address in format_bootif to lower.

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

Looks good.

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-02 20:14:18 +0000
3+++ src/provisioningserver/boot/powernv.py 2014-10-22 17:33:10 +0000
4@@ -62,7 +62,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-02 20:14:18 +0000
16+++ src/provisioningserver/boot/tests/test_powernv.py 2014-10-22 17:33:10 +0000
17@@ -229,6 +229,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: