sane-vpn: fix so that sane-vpn do works even without hickory-dns installed

This commit is contained in:
2024-11-06 09:50:57 +00:00
parent b6a368419e
commit 4e402266b2

View File

@@ -294,6 +294,11 @@ stores = {{ type = "forward", name_servers = [
'''
elif dir_ == ToggleDir.Down:
text = ""
if not os.path.isdir("/var/lib/hickory-dns"):
logger.info("not restarting hickory-dns because it appears to not be in use")
return
with open("/var/lib/hickory-dns/dhcp-configs/sane-vpn.toml", "w") as f:
f.write(text)
subprocess.check_call([ "systemctl", "restart", "hickory-dns-localhost" ])