[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fab-user] Consolidating tasks that target both local and remote environ
From: |
Paul Walsh |
Subject: |
[Fab-user] Consolidating tasks that target both local and remote environments |
Date: |
Sun, 10 Nov 2013 17:16:16 +0200 |
Hi all,
I've been using Fabric for some time, and just learning what I need to know as
I need to know it.
However, in the last months, I've started packaging up my commonly used tasks
so I can just include the package in my various projects, and not copy/paste my
fabfiles.
In packaging my code, I looked for ways to make things more generic, and the
one thing I find annoying in this endeavour is the distinction between `local`
on one hand, and `run` & `sudo` on the other. I have quite a bit of code that I
end up writing twice - one task to wrap calls in local, and another one exactly
the same, but using run and/or sudo.
I am wondering if there are any best practices for dealing with this.
A simple example:
#fabfile/local.py
@task
def db_drop():
local('code to drop the db')
#fabfile/remote.py
@task
db_drop():
run('code to drop the db')
- [Fab-user] Consolidating tasks that target both local and remote environments,
Paul Walsh <=