global-functions: $WaitForFile: check that we can get properties

Looks like RouterOS 7.18beta2 brings more breakage. Having a file
available in listing is just the first step now. We also need to make
sure that the file properties are accessible... 🤪

I have seen this taking several tens of seconds at least... 🤪🤪 So
let's just try until we have properties available, or the file vanishes.

Reported as SUP-179200. 🤞
This commit is contained in:
Christian Hesse 2025-02-11 19:14:42 +01:00
parent d41f758550
commit c8759381e9

View file

@ -1669,6 +1669,7 @@
:global CleanFilePath;
:global EitherOr;
:global LogPrintOnce;
:global MAX;
:set FileName [ $CleanFilePath $FileName ];
@ -1682,7 +1683,20 @@
:delay $Delay;
:set I ($I + 1);
}
:return true;
:while ([ :len [ /file/find where name=$FileName ] ] > 0) do={
:do {
/file/get $FileName;
:return true;
} on-error={
$LogPrintOnce warning $0 \
("Hit the infamous file handling breakage (SUP-179200) introduced with RouterOS 7.18beta2...");
}
:delay $Delay;
:set Delay ($Delay * 3 / 2);
}
:return false;
}
# wait to be fully connected (default route is reachable, time is sync, DNS resolves)