Indeed, the above function returns a set of indicators/ids instead of a single one. The interesting fact is that if I replace $address with an IP address (e.g., 10.0.0.1) the script works perfectly.
Note: I made a test by putting $address as a global variable and check its content; the content is correct, as it contains only one IP address.
I have not time or possibility to test all, but for me the script does not work at all without = after in.
No need to add ; after all lines, only between multiple commands on same line.
You can save some by go to correct folder before running commands so some rewriting
Edit as eworm writes, it may be that you have used reserved variable. Edited to not make conflicy.
/ip firewall address-list
:foreach key,value in=[find where list=no_internet_access] do={
:local Address [get $value address]
:local comment [/ip dhcp-server lease get [/ip dhcp-server lease find address=$Address] comment]
set [find where address=$Address] comment=$comment
}
To test it out in terminal wrap code in {}
{
/ip firewall address-list
:foreach key,value in=[find where list=no_internet_access] do={
:local Address [get $value address]
:local comment [/ip dhcp-server lease get [/ip dhcp-server lease find address=$Address] comment]
set [find where Address=$address] comment=$comment
}
}