mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-23 17:16:33 +00:00
Init template sooner (#2194)
This commit is contained in:
parent
f71549e3df
commit
8cbb4b510b
@ -91,6 +91,12 @@ class Audio(JsonConfig, CoreSysAttributes):
|
||||
|
||||
async def load(self) -> None:
|
||||
"""Load Audio setup."""
|
||||
# Initialize Client Template
|
||||
try:
|
||||
self.client_template = jinja2.Template(PULSE_CLIENT_TMPL.read_text())
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't read pulse-client.tmpl: %s", err)
|
||||
|
||||
# Check Audio state
|
||||
try:
|
||||
# Evaluate Version if we lost this information
|
||||
@ -114,12 +120,6 @@ class Audio(JsonConfig, CoreSysAttributes):
|
||||
if not await self.instance.is_running():
|
||||
await self.start()
|
||||
|
||||
# Initialize Client Template
|
||||
try:
|
||||
self.client_template = jinja2.Template(PULSE_CLIENT_TMPL.read_text())
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't read pulse-client.tmpl: %s", err)
|
||||
|
||||
# Setup default asound config
|
||||
asound = self.sys_config.path_audio.joinpath("asound")
|
||||
if not asound.exists():
|
||||
|
@ -131,9 +131,18 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
|
||||
|
||||
async def load(self) -> None:
|
||||
"""Load DNS setup."""
|
||||
self._init_hosts()
|
||||
# Initialize CoreDNS Template
|
||||
try:
|
||||
self.resolv_template = jinja2.Template(RESOLV_TMPL.read_text())
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't read resolve.tmpl: %s", err)
|
||||
try:
|
||||
self.hosts_template = jinja2.Template(HOSTS_TMPL.read_text())
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't read hosts.tmpl: %s", err)
|
||||
|
||||
# Check CoreDNS state
|
||||
self._init_hosts()
|
||||
try:
|
||||
# Evaluate Version if we lost this information
|
||||
if not self.version:
|
||||
@ -153,16 +162,6 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
|
||||
self.image = self.instance.image
|
||||
self.save_data()
|
||||
|
||||
# Initialize CoreDNS Template
|
||||
try:
|
||||
self.resolv_template = jinja2.Template(RESOLV_TMPL.read_text())
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't read resolve.tmpl: %s", err)
|
||||
try:
|
||||
self.hosts_template = jinja2.Template(HOSTS_TMPL.read_text())
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't read hosts.tmpl: %s", err)
|
||||
|
||||
# Run CoreDNS
|
||||
with suppress(CoreDNSError):
|
||||
if not await self.instance.is_running():
|
||||
|
Loading…
x
Reference in New Issue
Block a user