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[
"comment"
].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:
self.data["host"][uid]["host-name"] = dns_vals[
"name"
].split(".")[0]
break
# Resolve hostname from DHCP comment
if (
self.data["host"][uid]["host-name"] == "unknown"