fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Purely local tasks


From: Jorge Vargas
Subject: Re: [Fab-user] Purely local tasks
Date: Thu, 26 Sep 2013 01:39:36 -0400

On Mon, Sep 23, 2013 at 11:00 PM, Jon Dufresne <address@hidden> wrote:
On Mon, Sep 23, 2013 at 6:13 PM, Jorge Vargas <address@hidden> wrote:
Sadly no, if you search the archives they are many attempts to do this and in the end the best option is to just use local() all over the place, which removes some of the advanced functions of fabric like the puts() you mention. 

As in local('echo ...'), or should I simply use Python's print at this point?

print is what I do. 
 
Or configure your machine/environment in a way that fabric can ssh to the same machine you are runnings things from foolling it into thinking it's a remote machine.

Something like this?

def local_task(f):
    user = getpass.getuser()
    wrapper = hosts('address@hidden' % user)
    return wrapper(task(f))

@local_task
def my_task():
   ...

Is this reliable across multiple environments? Will this require the running machine to also be running an SSH server?

yes and yes. 

right or you could just set @hosts('localhost') 


Which of these to solutions is better in the end?

Again it depends on how much of fabric you use. if your task uses anything other than local() you are probably best using the SSH into your own machine.
 
 
Thanks,
Jon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]