fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] api.run: fatal errors versus exceptions


From: Paul Hoffman
Subject: Re: [Fab-user] api.run: fatal errors versus exceptions
Date: Thu, 19 Jan 2012 10:40:11 -0800

On Wed, Jan 18, 2012 at 10:07 PM, Steve Hajducko <address@hidden> wrote:
> Why try and do it this way?

Because the method in the tutorial doesn't work in many cases that one
might care about.

> The tutorial lists a much simpler way:
>
> with settings(warn_only=True):
>        ThisRet = fabric.api.run(CmdString)
>    if ThisRet.failed and not confirm("Tests failed. Continue anyway?"):
>        abort("Aborting at user request.")

That only works if the CmdString gets executed and returns a non-zero
value. If CmdString doesn't get executed (such as because the target
machine is down or you use the wrong password), the program aborts
before the "if ThisRet.failed" is evaluated.

This is related to my question earlier this week about "put" as well.

--Paul Hoffman



reply via email to

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