D3494 introduces a Flask application in rOPS to execute ccache-metrics when a request reaches /metrics/ccache.
Basically, this application allows to run an executable and pass the response with a specific content-type header. It's a quick alternative to CGI.
Here an example of how routes are defined.
Routes don't accept any parameter, so there is no shell injection risk, only DoS risk.
api-exec.conf (partial)
routes: /status: echo 200 ALIVE /metrics/ccache: command: ccache-metrics mime_type: application/openmetrics-text /version: cat /etc/os-release /version/runtime: freebsd-version -r
Plan:
- create a repository
- write documentation like the salt-wrapper one
- release the application on Python Package Index (PyPI)