Fabric is a tidy tool for deployment that neatly wraps up fussy, manual tasks into a tidy Python syntax. The simple API wraps up most of your common deployment tasks into contexts which allow you to perform tasks either locally or sequentially on remote servers, using a transparent SSH mechanism. Magic.
Because its all Python syntax, my temptation was to perform local tasks like directory creation using native Python. To initiate a local ‘build’ directory, I tried:
1 2 3 4 5 6 7 8 9
For reasons that are not immediately apparent to me, this process fails rather silently. But reading the Fabric manual, it does specify that Fabric is:
- A tool that lets you execute arbitrary Python functions via the command line
- A library of subroutines (built on top of a lower-level library) to make executing shell commands over SSH easy and Pythonic.
As it turns out, the preferred way of doing this, is to use a local() task to drive the command line tools more directly. So instead, our fabfile looks like:
1 2 3 4
Simple, straightforward and pretty intuitive.