Merge lp:~daniel-thewatkins/charm-helpers/lp1370053 into lp:charm-helpers

Proposed by Dan Watkins on 2015-06-02
Status: Merged
Merged at revision: 409
Proposed branch: lp:~daniel-thewatkins/charm-helpers/lp1370053
Merge into: lp:charm-helpers
Diff against target: 28 lines (+9/-1)
2 files modified
charmhelpers/contrib/storage/linux/utils.py (+1/-1)
tests/contrib/storage/test_linux_storage_utils.py (+8/-0)
To merge this branch: bzr merge lp:~daniel-thewatkins/charm-helpers/lp1370053
Reviewer Review Type Date Requested Status
Marco Ceppi 2015-06-02 Approve on 2015-07-22
Review via email: mp+260864@code.launchpad.net

Description of the Change

On AWS, ephemeral disks can be presented as full disks formatted and mounted as ext4; in our repository charm we would hit problems reformatting them because they weren't reported as mounted.

This fixes that.

To post a comment you must log in.
Marco Ceppi (marcoceppi) wrote :

LGTM +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/storage/linux/utils.py'
2--- charmhelpers/contrib/storage/linux/utils.py 2015-01-22 06:06:03 +0000
3+++ charmhelpers/contrib/storage/linux/utils.py 2015-06-02 17:06:32 +0000
4@@ -67,4 +67,4 @@
5 out = check_output(['mount']).decode('UTF-8')
6 if is_partition:
7 return bool(re.search(device + r"\b", out))
8- return bool(re.search(device + r"[0-9]+\b", out))
9+ return bool(re.search(device + r"[0-9]*\b", out))
10
11=== modified file 'tests/contrib/storage/test_linux_storage_utils.py'
12--- tests/contrib/storage/test_linux_storage_utils.py 2014-11-25 13:38:01 +0000
13+++ tests/contrib/storage/test_linux_storage_utils.py 2015-06-02 17:06:32 +0000
14@@ -88,6 +88,14 @@
15 self.assertFalse(result)
16
17 @patch(STORAGE_LINUX_UTILS + '.check_output')
18+ def test_is_device_mounted_full_disks(self, check_output):
19+ '''It detects mounted full disks as mounted.'''
20+ check_output.return_value = (
21+ b"/dev/sda on / type ext4 (rw,errors=remount-ro)\n")
22+ result = storage_utils.is_device_mounted('/dev/sda')
23+ self.assertTrue(result)
24+
25+ @patch(STORAGE_LINUX_UTILS + '.check_output')
26 def test_is_device_mounted_cciss(self, check_output):
27 '''It detects mounted cciss partitions as mounted.'''
28 check_output.return_value = (

Subscribers

People subscribed via source and target branches