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)​
​. The tasks are in a subfolder in the Flask project. Here is a small Gist
with the main function :
https://gist.github.com/nMustaki/507c336013bf15a9f289

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
<http://www.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).
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to