IPSEC src-address script failing now on 5.22

I have been running the below script and it has been working until I upgraded to 5.22. If I run the script with a “:global” it runs. Any ideas what might be the issue?

:local currentip [:resolve ABC.com]
:foreach int in=[/ip ipsec policy find] do={:if ([/ip ipsec policy get $int sa-src-address] != $currentip) do={/ip ipsec policy set $int sa-src-address=$currentip}}

Hm… works for me in 5.22. Where is the script run from? (script, scheduler, other?).

Try putting it inside curly braces and running in the terminal, see if it works or there are any errors.

{
:local currentip [:resolve ABC.com]
:foreach int in=[/ip ipsec policy find] do={:if ([/ip ipsec policy get $int sa-src-address] != $currentip) do={/ip ipsec policy set $int sa-src-address=$currentip}}
}

Was an issue with the scheduler not the script. It was failing in a terminal as the :local wasn’t persistent on the second line. Once I resolved the scheduler issue it worked.

Thanks for the look though.