collect-wireless-mac: do not fail on missing dns record

This commit is contained in:
Christian Hesse 2021-07-06 22:32:42 +02:00
parent 5083ffd12f
commit c982cde0bd
3 changed files with 12 additions and 9 deletions

View file

@ -55,9 +55,10 @@ $ScriptLock $0 false 10;
:if ([ :len $HostName ] = 0) do={
:set HostName "no hostname";
}
:set DnsName [ / ip dns static get ([ find where address=$Address ]->0) name ];
:if ([ :len $DnsName ] = 0) do={
:set DnsName "no dns name";
:set DnsName "no dns name";
:local DnsRec ([ / ip dns static find where address=$Address ]->0);
:if ([ :len $DnsRec ] > 0) do={
:set DnsName [ / ip dns static get $DnsRec name ];
}
}
:local DateTime ([ / system clock get date ] . " " . [ / system clock get time ]);

View file

@ -55,9 +55,10 @@ $ScriptLock $0 false 10;
:if ([ :len $HostName ] = 0) do={
:set HostName "no hostname";
}
:set DnsName [ / ip dns static get ([ find where address=$Address ]->0) name ];
:if ([ :len $DnsName ] = 0) do={
:set DnsName "no dns name";
:set DnsName "no dns name";
:local DnsRec ([ / ip dns static find where address=$Address ]->0);
:if ([ :len $DnsRec ] > 0) do={
:set DnsName [ / ip dns static get $DnsRec name ];
}
}
:set ($RegVal->"ssid") [ / interface wireless get [ find where name=($RegVal->"interface") ] ssid ];

View file

@ -56,9 +56,10 @@ $ScriptLock $0 false 10;
:if ([ :len $HostName ] = 0) do={
:set HostName "no hostname";
}
:set DnsName [ / ip dns static get ([ find where address=$Address ]->0) name ];
:if ([ :len $DnsName ] = 0) do={
:set DnsName "no dns name";
:set DnsName "no dns name";
:local DnsRec ([ / ip dns static find where address=$Address ]->0);
:if ([ :len $DnsRec ] > 0) do={
:set DnsName [ / ip dns static get $DnsRec name ];
}
}
:set ($RegVal->"ssid") [ / interface wireless get [ find where name=($RegVal->"interface") ] ssid ];