mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 11:06:32 +00:00
commit
5a60d5cbe8
@ -163,7 +163,7 @@ class APIAudio(CoreSysAttributes):
|
|||||||
@api_process
|
@api_process
|
||||||
async def set_profile(self, request: web.Request) -> None:
|
async def set_profile(self, request: web.Request) -> None:
|
||||||
"""Set audio default sources."""
|
"""Set audio default sources."""
|
||||||
body = await api_validate(SCHEMA_DEFAULT, request)
|
body = await api_validate(SCHEMA_PROFILE, request)
|
||||||
|
|
||||||
await asyncio.shield(
|
await asyncio.shield(
|
||||||
self.sys_host.sound.set_profile(body[ATTR_CARD], body[ATTR_NAME])
|
self.sys_host.sound.set_profile(body[ATTR_CARD], body[ATTR_NAME])
|
||||||
|
@ -3,7 +3,7 @@ from enum import Enum
|
|||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
SUPERVISOR_VERSION = "205"
|
SUPERVISOR_VERSION = "207"
|
||||||
|
|
||||||
|
|
||||||
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"""Audio docker object."""
|
"""Audio docker object."""
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
import logging
|
import logging
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
from ..const import ENV_TIME
|
from ..const import ENV_TIME
|
||||||
from ..coresys import CoreSysAttributes
|
from ..coresys import CoreSysAttributes
|
||||||
@ -25,6 +27,22 @@ class DockerAudio(DockerInterface, CoreSysAttributes):
|
|||||||
"""Return name of Docker container."""
|
"""Return name of Docker container."""
|
||||||
return AUDIO_DOCKER_NAME
|
return AUDIO_DOCKER_NAME
|
||||||
|
|
||||||
|
@property
|
||||||
|
def volumes(self) -> Dict[str, Dict[str, str]]:
|
||||||
|
"""Return Volumes for the mount."""
|
||||||
|
volumes = {
|
||||||
|
str(self.sys_config.path_extern_audio): {"bind": "/data", "mode": "rw"},
|
||||||
|
"/etc/group": {"bind": "/host/group", "mode": "ro"},
|
||||||
|
}
|
||||||
|
|
||||||
|
# SND support
|
||||||
|
if Path("/dev/snd").exists():
|
||||||
|
volumes.update({"/dev/snd": {"bind": "/dev/snd", "mode": "rw"}})
|
||||||
|
else:
|
||||||
|
_LOGGER.warning("Kernel have no audio support in")
|
||||||
|
|
||||||
|
return volumes
|
||||||
|
|
||||||
def _run(self) -> None:
|
def _run(self) -> None:
|
||||||
"""Run Docker image.
|
"""Run Docker image.
|
||||||
|
|
||||||
@ -48,14 +66,7 @@ class DockerAudio(DockerInterface, CoreSysAttributes):
|
|||||||
detach=True,
|
detach=True,
|
||||||
privileged=True,
|
privileged=True,
|
||||||
environment={ENV_TIME: self.sys_timezone},
|
environment={ENV_TIME: self.sys_timezone},
|
||||||
volumes={
|
volumes=self.volumes,
|
||||||
str(self.sys_config.path_extern_audio): {
|
|
||||||
"bind": "/data",
|
|
||||||
"mode": "rw",
|
|
||||||
},
|
|
||||||
"/dev/snd": {"bind": "/dev/snd", "mode": "rw"},
|
|
||||||
"/etc/group": {"bind": "/host/group", "mode": "ro"},
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self._meta = docker_container.attrs
|
self._meta = docker_container.attrs
|
||||||
|
@ -73,7 +73,7 @@ class AppArmorControl(CoreSysAttributes):
|
|||||||
# Copy to AppArmor folder
|
# Copy to AppArmor folder
|
||||||
dest_profile = Path(self.sys_config.path_apparmor, profile_name)
|
dest_profile = Path(self.sys_config.path_apparmor, profile_name)
|
||||||
try:
|
try:
|
||||||
shutil.copy(profile_file, dest_profile)
|
shutil.copyfile(profile_file, dest_profile)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
_LOGGER.error("Can't copy %s: %s", profile_file, err)
|
_LOGGER.error("Can't copy %s: %s", profile_file, err)
|
||||||
raise HostAppArmorError() from None
|
raise HostAppArmorError() from None
|
||||||
|
@ -115,7 +115,7 @@ class Supervisor(CoreSysAttributes):
|
|||||||
|
|
||||||
_LOGGER.info("Update Supervisor to version %s", version)
|
_LOGGER.info("Update Supervisor to version %s", version)
|
||||||
try:
|
try:
|
||||||
await self.instance.update(version, latest=True)
|
await self.instance.install(version, image=None, latest=True)
|
||||||
except DockerAPIError:
|
except DockerAPIError:
|
||||||
_LOGGER.error("Update of Supervisor fails!")
|
_LOGGER.error("Update of Supervisor fails!")
|
||||||
raise SupervisorUpdateError() from None
|
raise SupervisorUpdateError() from None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user