fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] try/except not working as expected.


From: Jeff Forcier
Subject: Re: [Fab-user] try/except not working as expected.
Date: Fri, 22 Oct 2010 10:55:04 -0400

Can you clarify what you mean by "system isn't ready"? If there is a
problem connecting to the remote end, period, then Fabric doesn't
currently have any great way to say "well, just keep trying!". (We
have a couple tickets open for this, though -- it's a known feature
request.)

If you're getting some other sort of problem, then a paste of the
output you're getting would be helpful :)

Best,
Jeff

On Fri, Oct 22, 2010 at 8:28 AM, Jeff Honey <address@hidden> wrote:
> I have a function that isn't working as I would expect. I 'try' a get(), 
> which fails since the system isn't ready, and I try to catch that exception 
> but it doesn't seem to be working. I tried adding warn_only=True to keep 
> Fabric from exiting on an error but that didn't seem to help.
>
> I tried to boil it down to the most common denominator but it is still 
> exiting entirely. This is, likely, just my never using the 'try' expression 
> before. The snippet below isn't what I started with but is what I have in my 
> code now...I know i shouldn't have a bare except as that is a dangerous way 
> to get stuck but I was grasping at straws.
>
> Maybe I should be asking this elsewhere but the majority of the expressions 
> I've got are unique to Fabric...all I am looking to accomplish is run my 
> get(), catch any exception, and then retry the get() until success. Once that 
> works, I can think about adding some sort of retry timer so it won't get 
> stuck forever inside the expression.
>
>
> <snip>
> def is_ready():
>  with settings(
>  hide('warnings', 'running', 'stdout', 'stderr'),
>  warn_only=True
>  ):
>  try:
>   get('/tmp/ready.txt','~/')
>  except:
>   time.sleep(10)
>   get('/tmp/ready.txt','~/')
> </snip>
>
>
>
> --
>  ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
> ¤ kyoboku kazeoshi ¤
>  ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org



reply via email to

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