API (sometimes) exits when local_nb_nodes.json
is a directory
#81
Labels
released
This issue/pull request has been released.
local_nb_nodes.json
is a directory
#81
Currently, the f-API expects that the local_nb_nodes.json file always exists (although it can handle when the file is empty).
In a docker compose setting, the f-API container exists silently (unless you examine the logs) when the file does not exist. This is because:
The docker compose recipe auto-mounts local_nb_nodes.json into the container, but if the file does not exist an empty directory is simply created (so there is no error from Docker itself)
The current f-API code does check if the path exists and if the contents are not empty (by checking path byte size), and only proceeds to parse the local nodes if these conditions are met:
federation-api/app/api/utility.py
Lines 71 to 77 in 1d34c05
However, on different filesystems such as Ubuntu, empty directories can apparently have a nonzero byte size due to filesystem overhead (!). So, this edge case actually causes the conditions to be met when someone launches our Compose recipe w/o a local_nb_nodes.json file, which then errors out inside the conditional b/c a file is expected.
To ensure the f-API can still be launched in the above scenario, we should have it check explicitly if:
The text was updated successfully, but these errors were encountered: