tikoci / restraml

RouterOS REST API "Schema Tools"
https://tikoci.github.io/restraml/
The Unlicense
12 stars 0 forks source link

Generate schemas with `extra-packages` too #7

Closed mobileskyfi closed 3 months ago

mobileskyfi commented 3 months ago

Tricky problem. Schema generation uses RouterOS's installed commands, which are based on the packages loaded.

Currently, all schema downloads are based on only routeros.npk, so schema for things in extra-packages are not included in the generated schemas.

[!NOTE] The script that generate the scheme works fine with extra-packages.
Also, automation using the "using-secret" workflow automation also works – now that depends on the packages installed on the router but installing packages is easy in that context.

Main issue is that it is side-effect of using CHR within the "docker-in-docker" workflow is that it not so easy to get extra packages installed. And, additional problems like:

mobileskyfi commented 3 months ago

Added new workflow to test adding packages and reboot CHR. See https://github.com/tikoci/restraml/blob/main/.github/workflows/manual-using-extra-docker-in-docker.yaml

It creates an "extra" directory under each version with the schema/inspect/doc with all extra-packages installed.

Only issue seem in some version the reboot command starts before return the results to the REST API. Fixable just by ignoring the error, and later checking the packages are actually installed via another REST call after reboot.

More work here too... since the download page needs updating to support two schemas for download, etc. But progress.

mobileskyfi commented 3 months ago

Only issue seem in some version the reboot command starts before return the results to the REST API. Fixable just by ignoring the error, and later checking the packages are actually installed via another REST call after reboot.

Ignored errors from reboot. ssh also disconnects before returning. Curiously happened only in 7.9, 7.9.2, 7.12.2, 7.14.3 — but 7.15rc4, 7.13, 7.10 seem to return form REST/ssh a result then reboot.

Refactoring the "Download Page" to use both version (main package &main + extra-packages)