Override name in DNS if DHCP comment exists #86

This commit is contained in:
tomaae 2021-04-12 13:27:22 +02:00
parent 27f1b14ec4
commit 77acb4b9fe

View file

@ -1723,11 +1723,20 @@ class MikrotikControllerData:
self.data["host"][uid]["host-name"] = dns_vals[ self.data["host"][uid]["host-name"] = dns_vals[
"comment" "comment"
].split("#", 1)[0] ].split("#", 1)[0]
elif (
uid in self.data["dhcp"]
and self.data["dhcp"][uid]["comment"] != ""
):
# Override name if DHCP comment exists
self.data["host"][uid]["host-name"] = self.data["dhcp"][
uid
]["comment"].split("#", 1)[0]
else: else:
self.data["host"][uid]["host-name"] = dns_vals[ self.data["host"][uid]["host-name"] = dns_vals[
"name" "name"
].split(".")[0] ].split(".")[0]
break break
# Resolve hostname from DHCP comment # Resolve hostname from DHCP comment
if ( if (
self.data["host"][uid]["host-name"] == "unknown" self.data["host"][uid]["host-name"] == "unknown"