[ ... 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...
This commit is contained in:
parent
92ca31a41d
commit
ff5cdc3019
20 changed files with 38 additions and 38 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue