1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 04:19:03 +00:00

Merge pull request #1247 from home-assistant/dev

Release 181
This commit is contained in:
Pascal Vizeli
2019-08-18 21:07:21 +02:00
committed by GitHub
3 changed files with 16 additions and 8 deletions

View File

@@ -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"

View File

@@ -1,8 +1,12 @@
.:53 {
log
errors
hosts /config/hosts {
fallthrough
}
template ANY AAAA local.hass.io hassio {
rcode NOERROR
}
forward . $servers {
except local.hass.io
policy sequential

View File

@@ -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()
@@ -231,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."""
@@ -343,7 +347,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 +361,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