Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for mounting fails on SMB provider #1631

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions music_assistant/server/providers/filesystem_smb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

import os
import platform
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -187,6 +186,10 @@ async def mount(self) -> None:
if mount_options := str(self.config.get_value(CONF_MOUNT_OPTIONS)):
options += mount_options.split(",")

options += ["username", f'"{username}"']
if password:
options += ["password", f'"{password}"']

options_str = ",".join(options)
mount_cmd = [
"mount",
Expand All @@ -197,7 +200,6 @@ async def mount(self) -> None:
f"//{server}/{share}{subfolder}",
self.base_path,
]

else:
msg = f"SMB provider is not supported on {platform.system()}"
raise LoginFailed(msg)
Expand All @@ -207,14 +209,7 @@ async def mount(self) -> None:
"Using mount command: %s",
[m.replace(str(password), "########") if password else m for m in mount_cmd],
)
env_vars = {
**os.environ,
"USER": username,
}
if password:
env_vars["PASSWD"] = str(password)

returncode, output = await check_output(*mount_cmd, env=env_vars)
returncode, output = await check_output(*mount_cmd)
if returncode != 0:
msg = f"SMB mount failed with error: {output.decode()}"
raise LoginFailed(msg)
Expand Down