[Top][All Lists]

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

Re: [Fab-user] try: run except run ?

From: Jorge Vargas
Subject: Re: [Fab-user] try: run except run ?
Date: Wed, 20 May 2009 18:04:04 -0400

On Wed, May 20, 2009 at 5:03 PM, Jeff Forcier <address@hidden> wrote:
> Hi Jorge,
> First, note that you may want to try using
> `fabric.contrib.files.contains` instead of manually calling
> ``run('grep text file')``. It's got a couple of niceties that should
> make it relatively useful, though I'm sure it could be expanded upon.
ahh cool I missed that one.

>> but this bit of code in run() is preventing it from happening
>> <snip>
>> how can I do this?
> How exactly is it preventing it from happening? If you mean the
> failure handler is causing Fabric to abort, then what you want is to
> do the following to change Fab's behavior from "abort always" to "only
> warn me, and keep going"::

grep returns 1 on a no match which is being picked up by the error handler.

>    with settings(warn_only=True):
>        run('foo')
> However, note that ``contrib.files.contains`` already does this internally --
> i.e. it will always return True or False and will never cause Fabric to bail
> out -- which is another big reason to use it IMHO :)
yea that makes total sense I'm upgrading my code to that now.

> Thanks,
> Jeff

reply via email to

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