Merge lp:~hopem/charm-helpers/lp1257491 into lp:charm-helpers

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 107
Proposed branch: lp:~hopem/charm-helpers/lp1257491
Merge into: lp:charm-helpers
Diff against target: 23 lines (+3/-2)
2 files modified
charmhelpers/contrib/storage/linux/utils.py (+1/-1)
tests/contrib/storage/test_linux_storage_utils.py (+2/-1)
To merge this branch: bzr merge lp:~hopem/charm-helpers/lp1257491
Reviewer Review Type Date Requested Status
James Page Pending
Review via email: mp+198266@code.launchpad.net

This proposal supersedes a proposal from 2013-12-09.

To post a comment you must log in.
Revision history for this message
James Page (james-page) wrote : Posted in a previous version of this proposal

Hi Ed

Please update the associated test as well;

======================================================================
FAIL: It calls sgdisk correctly to zap disk
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jamespage/src/charms/charm-helpers/charm-helpers/tests/contrib/storage/test_linux_storage_utils.py", line 15, in test_zap_disk
    check_call.assert_called_with(['sgdisk', '--zap-all', '/dev/foo'])
  File "/usr/lib/python2.7/dist-packages/mock.py", line 835, in assert_called_with
    raise AssertionError(msg)
AssertionError: Expected call: check_call(['sgdisk', '--zap-all', '/dev/foo'])
Actual call: check_call(['sgdisk', '--zap-all', '--mbrtogpt', '/dev/foo'])

I was also pondering whether target format should be an option (MBR or GPT) but I guess this covers 100% of use cases right now.

Ta

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charmhelpers/contrib/storage/linux/utils.py'
--- charmhelpers/contrib/storage/linux/utils.py 2013-06-24 22:39:29 +0000
+++ charmhelpers/contrib/storage/linux/utils.py 2013-12-09 14:09:24 +0000
@@ -22,4 +22,4 @@
2222
23 :param block_device: str: Full path of block device to clean.23 :param block_device: str: Full path of block device to clean.
24 '''24 '''
25 check_call(['sgdisk', '--zap-all', block_device])25 check_call(['sgdisk', '--zap-all', '--mbrtogpt', block_device])
2626
=== modified file 'tests/contrib/storage/test_linux_storage_utils.py'
--- tests/contrib/storage/test_linux_storage_utils.py 2013-06-24 22:39:29 +0000
+++ tests/contrib/storage/test_linux_storage_utils.py 2013-12-09 14:09:24 +0000
@@ -12,7 +12,8 @@
12 '''It calls sgdisk correctly to zap disk'''12 '''It calls sgdisk correctly to zap disk'''
13 with patch(STORAGE_LINUX_UTILS + '.check_call') as check_call:13 with patch(STORAGE_LINUX_UTILS + '.check_call') as check_call:
14 storage_utils.zap_disk('/dev/foo')14 storage_utils.zap_disk('/dev/foo')
15 check_call.assert_called_with(['sgdisk', '--zap-all', '/dev/foo'])15 check_call.assert_called_with(['sgdisk', '--zap-all', '--mbrtogpt',
16 '/dev/foo'])
1617
17 @patch(STORAGE_LINUX_UTILS + '.stat')18 @patch(STORAGE_LINUX_UTILS + '.stat')
18 @patch(STORAGE_LINUX_UTILS + '.S_ISBLK')19 @patch(STORAGE_LINUX_UTILS + '.S_ISBLK')

Subscribers

People subscribed via source and target branches