Merge ~jasonzio/cloud-init:fixmounterrormatch into cloud-init:master
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | ~jasonzio/cloud-init:fixmounterrormatch | ||||
Merge into: | cloud-init:master | ||||
Diff against target: |
53 lines (+15/-16) 2 files modified
cloudinit/sources/DataSourceAzure.py (+1/-1) tests/unittests/test_datasource/test_azure.py (+14/-15) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Server Team CI bot | continuous-integration | Needs Fixing | |
Review via email: mp+357669@code.launchpad.net |
This proposal has been superseded by a proposal from 2018-11-12.
Commit message
azure: Accept variation in error msg from mount for ntfs volumes
If Azure detects an ntfs filesystem type during mount attempt, it should
still report the resource device as reformattable. There are slight
differences in error message format on RedHat and SuSE. This patch
simplifies the expected error match to work on both distributions.
LP: #1799338
Description of the change
Fixes lp:1799338 by omitting the prefix of the error message from the text-to-match. This skips the part of the error message that differs between RHEL and SUSE without introducing a regexp match, which would be needlessly expensive in this case.
Unmerged commits
- 4d23c58... by Jason Zions <email address hidden>
- b8b0db1... by Jason Zions <email address hidden>
Thank you for this branch.
I'm trying to decide if it's worth noting the SLES/RHEL differences by extending the existing unit test test_ntfs_ mount_errors_ true in tests/unittests /test_datasourc e/test_ azure.py.
I like getting test coverage to explain what 'mocked' expectation are and why to give future-us context on what to worry about with a change.
How's this patch look?
diff --git a/tests/ unittests/ test_datasource /test_azure. py b/tests/ unittests/ test_datasource /test_azure. py unittests/ test_datasource /test_azure. py unittests/ test_datasource /test_azure. py ormatted( CiTestCase) :
'/dev/sda1' : {'num': 1, 'fs': 'ntfs', 'files': []}
}}})
index 4c5c6c1..b4bc48d 100644
--- a/tests/
+++ b/tests/
@@ -1510,21 +1510,20 @@ class TestCanDevBeRef
- err = ("Unexpected error while running command.\n", mount_cb. side_effect = MountFailedError( dev_be_ reformatted( '/dev/sda' , ntfs=False) (value) 'cannot mount NTFS, assuming', msg) mount_cb. side_effect = MountFailedError( dev_be_ reformatted( ntfs=False) (value) 'cannot mount NTFS, assuming', msg)
- "Command: ['mount', '-o', 'ro,sync', '-t', 'auto', ",
- "'/dev/sda1', '/fake-tmp/dir']\n"
- "Exit code: 32\n"
- "Reason: -\n"
- "Stdout: -\n"
- "Stderr: mount: unknown filesystem type 'ntfs'")
- self.m_
- 'Failed mounting %s to %s due to: %s' %
- ('/dev/sda', '/fake-tmp/dir', err))
-
- value, msg = dsaz.can_
- preserve_
- self.assertTrue
- self.assertIn(
+ error_msgs = [
+ "Stderr: mount: unknown filesystem type 'ntfs'", # RHEL
+ "Stderr: mount: /dev/sdb1: unknown filesystem type 'ntfs'" # SLES
+ ]
+
+ for err_msg in error_msgs:
+ self.m_
+ 'Failed mounting %s to %s due to: %s' %
+ ('/dev/sda', '/fake-tmp/dir', err_msg))
+
+ value, msg = dsaz.can_
+ '/dev/sda', preserve_
+ self.assertTrue
+ self.assertIn(
def test_never_ destroy_ ntfs_config_ false(self) :
"""Normally formattable situation with never_destroy_ntfs set."""