[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] how to skip unreachable hosts
From: |
John Eikenberry |
Subject: |
Re: [Fab-user] how to skip unreachable hosts |
Date: |
Thu, 20 Oct 2011 14:06:00 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
John Eikenberry wrote:
> Nicolas Michel wrote:
>
> > Hello,
> >
> > I have some roles where sometimes hosts are unreachable. For now the fab
> > tool exit the loop and don't execute the code on further hosts of my role
> > list.
> > Is there a way to avoid that behavior, set a kind of timeout and skip the
> > host if fab can't connect to it?
>
> If you can work it into your code, it is easy to do manually.
>
> def online(host):
> """ Is host reachable on the network?
> """
> if _quiet(fab.local)("ping -c 1 -W 1 %s" % host).failed:
> return False
> return True
Opps. Forgot to clean out that _quiet(). It just wraps the command in some
contexts to shut up various output.
> _______________________________________________
> Fab-user mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fab-user
--
John Eikenberry
[ address@hidden - http://zhar.net ]
[ PGP public key @ http://zhar.net/jae_at_zhar_net.gpg ]
________________________________________________________________________
"Perfection is attained, not when no more can be added, but when no more
can be removed." -- Antoine de Saint-Exupery
signature.asc
Description: Digital signature