From 4bed8c1327a6b747bb8912b77a5db5698839cf8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 20 Jun 2023 16:20:06 +0200 Subject: [PATCH] Allow mounting CIFS as guest (#4384) --- supervisor/mounts/mount.py | 4 ++-- tests/mounts/test_manager.py | 1 + tests/mounts/test_mount.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/supervisor/mounts/mount.py b/supervisor/mounts/mount.py index e08a00e4b..5444ec0e9 100644 --- a/supervisor/mounts/mount.py +++ b/supervisor/mounts/mount.py @@ -359,8 +359,8 @@ class CIFSMount(NetworkMount): """Options to use to mount.""" return ( super().options + [f"username={self.username}", f"password={self.password}"] - if self.username - else [] + if self.username and self.password + else ["guest"] ) diff --git a/tests/mounts/test_manager.py b/tests/mounts/test_manager.py index 839a04ae3..bbed5a599 100644 --- a/tests/mounts/test_manager.py +++ b/tests/mounts/test_manager.py @@ -116,6 +116,7 @@ async def test_load( "mnt-data-supervisor-mounts-backup_test.mount", "fail", [ + ["Options", Variant("s", "guest")], ["Type", Variant("s", "cifs")], ["Description", Variant("s", "Supervisor cifs mount: backup_test")], ["What", Variant("s", "//backup.local/backups")], diff --git a/tests/mounts/test_mount.py b/tests/mounts/test_mount.py index 24183686a..91f70b3ba 100644 --- a/tests/mounts/test_mount.py +++ b/tests/mounts/test_mount.py @@ -177,6 +177,7 @@ async def test_load( "mnt-data-supervisor-mounts-test.mount", "fail", [ + ["Options", Variant("s", "guest")], ["Type", Variant("s", "cifs")], ["Description", Variant("s", "Supervisor cifs mount: test")], ["What", Variant("s", "//test.local/share")],