mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 01:56:34 +00:00
Handle exception on DNS for add-ons (#2042)
* Handle exception on DNS for add-ons * fix logger * capture exception
This commit is contained in:
parent
7be508214a
commit
da83edf231
@ -26,7 +26,7 @@ from ..const import (
|
|||||||
SECURITY_PROFILE,
|
SECURITY_PROFILE,
|
||||||
)
|
)
|
||||||
from ..coresys import CoreSys
|
from ..coresys import CoreSys
|
||||||
from ..exceptions import DockerAPIError
|
from ..exceptions import CoreDNSError, DockerAPIError
|
||||||
from ..utils import process_lock
|
from ..utils import process_lock
|
||||||
from .interface import DockerInterface
|
from .interface import DockerInterface
|
||||||
|
|
||||||
@ -379,7 +379,13 @@ class DockerAddon(DockerInterface):
|
|||||||
_LOGGER.info("Start Docker add-on %s with version %s", self.image, self.version)
|
_LOGGER.info("Start Docker add-on %s with version %s", self.image, self.version)
|
||||||
|
|
||||||
# Write data to DNS server
|
# Write data to DNS server
|
||||||
self.sys_plugins.dns.add_host(ipv4=self.ip_address, names=[self.addon.hostname])
|
try:
|
||||||
|
self.sys_plugins.dns.add_host(
|
||||||
|
ipv4=self.ip_address, names=[self.addon.hostname]
|
||||||
|
)
|
||||||
|
except CoreDNSError as err:
|
||||||
|
_LOGGER.warning("Can't update DNS for %s", self.name)
|
||||||
|
self.sys_capture_exception(err)
|
||||||
|
|
||||||
def _install(
|
def _install(
|
||||||
self, tag: str, image: Optional[str] = None, latest: bool = False
|
self, tag: str, image: Optional[str] = None, latest: bool = False
|
||||||
@ -505,5 +511,9 @@ class DockerAddon(DockerInterface):
|
|||||||
Need run inside executor.
|
Need run inside executor.
|
||||||
"""
|
"""
|
||||||
if self.ip_address != NO_ADDDRESS:
|
if self.ip_address != NO_ADDDRESS:
|
||||||
self.sys_plugins.dns.delete_host(self.addon.hostname)
|
try:
|
||||||
|
self.sys_plugins.dns.delete_host(self.addon.hostname)
|
||||||
|
except CoreDNSError as err:
|
||||||
|
_LOGGER.warning("Can't update DNS for %s", self.name)
|
||||||
|
self.sys_capture_exception(err)
|
||||||
super()._stop(remove_container)
|
super()._stop(remove_container)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user