mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-01 13:04:28 +02:00
Override name in DNS if DHCP comment exists #86
This commit is contained in:
parent
27f1b14ec4
commit
77acb4b9fe
1 changed files with 9 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue