From 77be830b7294ed45a04f9906e81e51e5b881b145 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 18 Aug 2019 12:00:31 +0200 Subject: [PATCH 1/4] Bump version 181 --- hassio/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hassio/const.py b/hassio/const.py index 3e45005a9..c27cc021f 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -3,7 +3,7 @@ from pathlib import Path from ipaddress import ip_network -HASSIO_VERSION = "180" +HASSIO_VERSION = "181" URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons" URL_HASSIO_VERSION = "https://version.home-assistant.io/{channel}.json" From de3382226e34c4385e020db8205262d7d0c52590 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 18 Aug 2019 17:11:42 +0200 Subject: [PATCH 2/4] Update setting on startup (#1244) * Update setting on startup * Fix * fix exception * Cleanup handling --- hassio/dns.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hassio/dns.py b/hassio/dns.py index 798d2f9d9..9623d3da0 100644 --- a/hassio/dns.py +++ b/hassio/dns.py @@ -120,8 +120,9 @@ class CoreDNS(JsonConfig, CoreSysAttributes): # Start is not Running if await self.instance.is_running(): - return - await self.start() + await self.restart() + else: + await self.start() async def unload(self) -> None: """Unload DNS forwarder.""" @@ -146,6 +147,8 @@ class CoreDNS(JsonConfig, CoreSysAttributes): self.version = self.instance.version self.save_data() + # Init Hosts / Run server + self.write_hosts() await self.start() async def update(self, version: Optional[str] = None) -> None: @@ -174,14 +177,13 @@ class CoreDNS(JsonConfig, CoreSysAttributes): async def restart(self) -> None: """Restart CoreDNS plugin.""" + self._write_corefile() with suppress(DockerAPIError): - await self.instance.stop() - await self.start() + await self.instance.restart() async def start(self) -> None: """Run CoreDNS.""" self._write_corefile() - self.write_hosts() # Start Instance _LOGGER.info("Start CoreDNS plugin") @@ -195,6 +197,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes): """Reset Config / Hosts.""" self.servers = DNS_SERVERS + # Resets hosts with suppress(OSError): self.hosts.unlink() self._init_hosts() @@ -343,7 +346,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes): continue resolv_lines.append(line.strip()) except OSError as err: - _LOGGER.error("Can't read local resolv: %s", err) + _LOGGER.warning("Can't read local resolv: %s", err) raise CoreDNSError() from None if nameserver in resolv_lines: @@ -357,5 +360,5 @@ class CoreDNS(JsonConfig, CoreSysAttributes): for line in resolv_lines: resolv.write(f"{line}\n") except OSError as err: - _LOGGER.error("Can't write local resolv: %s", err) + _LOGGER.warning("Can't write local resolv: %s", err) raise CoreDNSError() from None From 4f381d01df795c56d53377125a4daa6a0b9a3abc Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 18 Aug 2019 17:21:46 +0200 Subject: [PATCH 3/4] Log coredns errors (#1245) --- hassio/data/coredns.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/hassio/data/coredns.tmpl b/hassio/data/coredns.tmpl index 01ed22b0c..9d24151ca 100644 --- a/hassio/data/coredns.tmpl +++ b/hassio/data/coredns.tmpl @@ -1,5 +1,6 @@ .:53 { log + errors hosts /config/hosts { fallthrough } From fb8216c102ee38eb3bceb13633e37a17ed19b346 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 18 Aug 2019 21:05:42 +0200 Subject: [PATCH 4/4] Fix AAAA resolv for nginx (#1246) --- hassio/data/coredns.tmpl | 3 +++ hassio/dns.py | 1 + 2 files changed, 4 insertions(+) diff --git a/hassio/data/coredns.tmpl b/hassio/data/coredns.tmpl index 9d24151ca..7ab08f4aa 100644 --- a/hassio/data/coredns.tmpl +++ b/hassio/data/coredns.tmpl @@ -4,6 +4,9 @@ hosts /config/hosts { fallthrough } + template ANY AAAA local.hass.io hassio { + rcode NOERROR + } forward . $servers { except local.hass.io policy sequential diff --git a/hassio/dns.py b/hassio/dns.py index 9623d3da0..a06bd81f0 100644 --- a/hassio/dns.py +++ b/hassio/dns.py @@ -234,6 +234,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes): ["homeassistant", "home-assistant"], write=False, ) + self.add_host(self.sys_docker.network.dns, ["dns"], write=False) def write_hosts(self) -> None: """Write hosts from memory to file."""