aboutsummaryrefslogtreecommitdiffstats
path: root/dhcp-to-dns
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-08-26 09:23:56 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-08-26 09:29:52 +0200
commitff5cdc30193ba69944f6772f213e63ea00678861 (patch)
treed73fac7cd08f5463c8a432dd5153695ae0cf2cf1 /dhcp-to-dns
parent92ca31a41df332171d1f2dcf08c75db570b12234 (diff)
[ ... print count-only ...] -> [ :len [ ... find ... ] ]
Using 'print count-only' always prints a number to terminal, even if the value is evaluated in a condition or assigned to a variable. This can be quite annoying. Behavior will not chance (SUP-25503), so replacing the code...
Diffstat (limited to 'dhcp-to-dns')
-rw-r--r--dhcp-to-dns4
1 files changed, 2 insertions, 2 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns
index 4e2c7f2..3a95eb6 100644
--- a/dhcp-to-dns
+++ b/dhcp-to-dns
@@ -22,7 +22,7 @@
:local Ttl 5m;
:local CommentPrefix "managed by dhcp-to-dns for ";
-:if ([ / ip dns static print count-only where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] = 0) do={
+:if ([ :len [ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] ] = 0) do={
/ ip dns static add comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled=yes;
$LogPrintExit warning "Added disabled static dns record with comment '--- dhcp-to-dns above ---'." false;
}
@@ -31,7 +31,7 @@
:foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={
: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={
+ :if ([ :len [ / ip dhcp-server lease find where mac-address=$MacAddress address=($DnsRecordVal->"address") dynamic=yes status=bound ] ] > 0) do={
$LogPrintExit debug ("Lease for " . $MacAddress . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false;
} else={
:local Found false;