aboutsummaryrefslogtreecommitdiffstats
path: root/dhcp-to-dns
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-03-05 08:37:12 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-03-05 08:37:12 +0100
commit554308a399fd2dea884396a7382f9ec46031a4c3 (patch)
treeef104d4787af8f1be99c9e9524131bd14f4aa5df /dhcp-to-dns
parentbe5b6e0687be98cbfefc7d381ab54e4577a670b0 (diff)
dhcp-to-dns: use $LogPrintExit
Diffstat (limited to 'dhcp-to-dns')
-rw-r--r--dhcp-to-dns15
1 files changed, 8 insertions, 7 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns
index 0d92278..94c1dfb 100644
--- a/dhcp-to-dns
+++ b/dhcp-to-dns
@@ -4,12 +4,13 @@
#
# check DHCP leases and add/remove/update DNS entries
-:global CharacterReplace;
-
:global Domain;
:global HostNameInZone;
:global Identity;
+:global CharacterReplace;
+:global LogPrintExit;
+
:local Zone;
:if ($HostNameInZone = true) do={
:set Zone ("dhcp." . $Identity . "." . $Domain);
@@ -23,10 +24,10 @@
:local DnsRecordVal [ / ip dns static get $DnsRecord ];
:local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
:if ([ / ip dhcp-server lease print count-only where mac-address=$MacAddress address=($DnsRecordVal->"address") dynamic=yes status=bound ] > 0) do={
- :log debug ("Lease for " . $MacAddress . " (" . $DnsRecordVal->"host-name" . ") still exists. Not deleting DNS entry.");
+ $LogPrintExit debug ("Lease for " . $MacAddress . " (" . $DnsRecordVal->"host-name" . ") still exists. Not deleting DNS entry.") false;
} else={
:local Found false;
- :log info ("Lease expired for " . $MacAddress . " (" . $DnsRecordVal->"name" . "), deleting DNS entry.");
+ $LogPrintExit info ("Lease expired for " . $MacAddress . " (" . $DnsRecordVal->"name" . "), deleting DNS entry.") false;
/ ip dns static remove $DnsRecord;
}
}
@@ -54,13 +55,13 @@
}
:if ($DnsIp = $LeaseVal->"address") do={
- :log debug ("DNS entry for " . $Fqdn . " does not need updating.");
+ $LogPrintExit debug ("DNS entry for " . $Fqdn . " does not need updating.") false;
} else={
- :log info ("Replacing DNS entry for " . $Fqdn . ", new address is " . $LeaseVal->"address" . ".");
+ $LogPrintExit info ("Replacing DNS entry for " . $Fqdn . ", new address is " . $LeaseVal->"address" . ".") false;
/ ip dns static set name=$Fqdn address=($LeaseVal->"address") ttl=$Ttl comment=$Comment $DnsRecord;
}
} else={
- :log info ("Adding new DNS entry for " . $Fqdn . ", address is " . $LeaseVal->"address" . ".");
+ $LogPrintExit info ("Adding new DNS entry for " . $Fqdn . ", address is " . $LeaseVal->"address" . ".") false;
/ ip dns static add name=$Fqdn address=($LeaseVal->"address") ttl=$Ttl comment=$Comment;
}
}