|
From: | Todd DeLuca |
Subject: | Re: [Fab-user] Consolidating tasks that target both local and remote environments |
Date: | Sun, 10 Nov 2013 11:28:12 -0500 |
I've found that running sshd on localhost allows one to treat it like a remote host when writing tasks.
Todd DeLuca
http://www.todddeluca.com
http://www.linkedin.com/in/todddeluca
Snt frm my tny kbrd
Hi Jens,That is a nice solution, thanks. I'll try something in this direction.On 10 Nov 2013, at 6:06 pm, Jens Rantil <address@hidden> wrote:Hi Paul,I have a function that uses `local` for localhost, and `run` otherwise. See https://gist.github.com/JensRantil/655b7f9ecd5af933f792 Not sure it solves your problem, but maybe could inspire you?Cheers,JensOn Sun, Nov 10, 2013 at 4:16 PM, Paul Walsh <address@hidden> wrote:
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 mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user
_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user
[Prev in Thread] | Current Thread | [Next in Thread] |