mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 18:16:32 +00:00
Fix Issue with pulse folder (#1573)
* Fix Issue with pulse folder * Fix config check
This commit is contained in:
parent
02aed9c084
commit
73e8875018
@ -393,6 +393,11 @@ class Addon(AddonModel):
|
|||||||
input_profile=self.audio_input, output_profile=self.audio_output
|
input_profile=self.audio_input, output_profile=self.audio_output
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Cleanup wrong maps
|
||||||
|
if self.path_pulse.is_dir():
|
||||||
|
shutil.rmtree(self.path_pulse, ignore_errors=True)
|
||||||
|
|
||||||
|
# Write pulse config
|
||||||
try:
|
try:
|
||||||
with self.path_pulse.open("w") as config_file:
|
with self.path_pulse.open("w") as config_file:
|
||||||
config_file.write(pulse_config)
|
config_file.write(pulse_config)
|
||||||
@ -400,11 +405,10 @@ class Addon(AddonModel):
|
|||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Add-on %s can't write pulse/client.config: %s", self.slug, err
|
"Add-on %s can't write pulse/client.config: %s", self.slug, err
|
||||||
)
|
)
|
||||||
raise AddonsError()
|
else:
|
||||||
|
_LOGGER.debug(
|
||||||
_LOGGER.debug(
|
"Add-on %s write pulse/client.config: %s", self.slug, self.path_pulse
|
||||||
"Add-on %s write pulse/client.config: %s", self.slug, self.path_pulse
|
)
|
||||||
)
|
|
||||||
|
|
||||||
async def install_apparmor(self) -> None:
|
async def install_apparmor(self) -> None:
|
||||||
"""Install or Update AppArmor profile for Add-on."""
|
"""Install or Update AppArmor profile for Add-on."""
|
||||||
|
@ -135,7 +135,17 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
detach=True,
|
detach=True,
|
||||||
stdout=True,
|
stdout=True,
|
||||||
stderr=True,
|
stderr=True,
|
||||||
volumes=self.volumes,
|
volumes={
|
||||||
|
str(self.sys_config.path_extern_homeassistant): {
|
||||||
|
"bind": "/config",
|
||||||
|
"mode": "rw",
|
||||||
|
},
|
||||||
|
str(self.sys_config.path_extern_ssl): {"bind": "/ssl", "mode": "ro"},
|
||||||
|
str(self.sys_config.path_extern_share): {
|
||||||
|
"bind": "/share",
|
||||||
|
"mode": "ro",
|
||||||
|
},
|
||||||
|
},
|
||||||
environment={ENV_TIME: self.sys_timezone},
|
environment={ENV_TIME: self.sys_timezone},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import os
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
import secrets
|
import secrets
|
||||||
|
import shutil
|
||||||
import time
|
import time
|
||||||
from typing import Any, AsyncContextManager, Awaitable, Dict, Optional
|
from typing import Any, AsyncContextManager, Awaitable, Dict, Optional
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
@ -237,12 +238,12 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
|
|||||||
@property
|
@property
|
||||||
def path_pulse(self):
|
def path_pulse(self):
|
||||||
"""Return path to asound config."""
|
"""Return path to asound config."""
|
||||||
return Path(self.sys_config.path_tmp, f"homeassistant_pulse")
|
return Path(self.sys_config.path_tmp, "homeassistant_pulse")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path_extern_pulse(self):
|
def path_extern_pulse(self):
|
||||||
"""Return path to asound config for Docker."""
|
"""Return path to asound config for Docker."""
|
||||||
return Path(self.sys_config.path_extern_tmp, f"homeassistant_pulse")
|
return Path(self.sys_config.path_extern_tmp, "homeassistant_pulse")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def audio_output(self) -> Optional[str]:
|
def audio_output(self) -> Optional[str]:
|
||||||
@ -644,6 +645,11 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
|
|||||||
input_profile=self.audio_input, output_profile=self.audio_output
|
input_profile=self.audio_input, output_profile=self.audio_output
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Cleanup wrong maps
|
||||||
|
if self.path_pulse.is_dir():
|
||||||
|
shutil.rmtree(self.path_pulse, ignore_errors=True)
|
||||||
|
|
||||||
|
# Write pulse config
|
||||||
try:
|
try:
|
||||||
with self.path_pulse.open("w") as config_file:
|
with self.path_pulse.open("w") as config_file:
|
||||||
config_file.write(pulse_config)
|
config_file.write(pulse_config)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user