I am building a webui on top of our
F
abric scripts with Flask. It was quite easy to set up, because it's not dynamic (url paths are hardcoded, each route call
the matching Fabric task)
Building a generic webui would be not easy because everyone would want a different blend of :
- autodiscovery of fabric tasks
- manual exclusion / inclusion of tasks
- access control
- autocreation of the url routes
- whether to capture and display Fabric output (at task end, line by line)
- if displaying fabric output, which method will you use to communicate with the client, websocket, wamp, ajax, etc
- how to pass parameters to tasks (if you want them to be usable from the cli, passing a dict to all tasks is not a good idea)
- how to gauge a task success, failure; display error messages
- scale the whole thing, as fabric task always take a few seconds to complete (at leat mines)
- etc
I wonder how Ansible, Salt and others web ui does it ?
I needed something quick and dirty, so I chose to :
- hardcode url paths and task calling
- ignore Fabric output
- get failure state from exception raising
- ignore performance issues
- communication with the client is done by ajax
I am also investigating a much nicer v2 with
Crossbar.io : WAMP (turbocharged websocket), async tasks and pub/sub. As of now, it's working but I had to completely intercept Fabric output, as it would crash the Twisted processes (output is not lost).