utils/mnt: fix mount permissions
This is a follow up to #1550 where we enabled a `rw` permissions mode, which is not ideal since it would theoretically be possible to set both `ro` and `rw` modes at the same time. This commit fixes the issue by only allowing one option at a time. Fixes #1588
This commit is contained in:
parent
2d2cdd8097
commit
6c0973238d
4 changed files with 25 additions and 10 deletions
|
|
@ -21,6 +21,14 @@ def test_mount_guard_failure_msg(tmp_path):
|
|||
assert "special device /dev/invalid-src does not exist" in str(e.value)
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.getuid() != 0, reason="root only")
|
||||
def test_mount_guard_incorrect_permissions_msg(tmp_path):
|
||||
with pytest.raises(ValueError) as e:
|
||||
with MountGuard() as mg:
|
||||
mg.mount("/dev/invalid-src", tmp_path, permissions="abc")
|
||||
assert "unknown filesystem permissions" in str(e.value)
|
||||
|
||||
|
||||
# This needs a proper refactor so that FileSystemMountService just uses
|
||||
# a common mount helper.
|
||||
class FakeFileSystemMountService(FileSystemMountService):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue