Re: [Fab-user] How to gracefully/elegantly collect data about failed hosts when using fabric.api.execute? (v1)

2018-05-17 Thread Brandon Whaley
By catching the exception raised when a connection fails. The connection doesn't initiate until the first time you call run() or another remote function. On Thu, May 17, 2018 at 1:08 PM Abhijeet Rastogi wrote: > Hi Brandon, > > Thanks. But how do I handle cases like

Re: [Fab-user] How to gracefully/elegantly collect data about failed hosts when using fabric.api.execute? (v1)

2018-05-17 Thread Abhijeet Rastogi
Hi Brandon, Thanks. But how do I handle cases like host connection failures etc? I don't have control over returning that information from task function. Thanks On Thu 17 May, 2018, 20:56 Brandon Whaley, wrote: > You need to have your worker function catch any exceptions

Re: [Fab-user] How to gracefully/elegantly collect data about failed hosts when using fabric.api.execute? (v1)

2018-05-17 Thread Brandon Whaley
You need to have your worker function catch any exceptions ( https://github.com/fabric/fabric/blob/1.14/fabric/exceptions.py) and evaluate success/failure, then return a value useful to you in determining if your task was successful. Returning "None" for failure modes is something I've done

Re: [Fab-user] How to gracefully/elegantly collect data about failed hosts when using fabric.api.execute? (v1)

2018-05-17 Thread Abhijeet Rastogi
Anyone? I was hoping if someone can help me with this. On Wed, May 16, 2018 at 9:03 PM Abhijeet Rastogi wrote: > Hi everyone, > > Let's suppose I have a simple code like this. > > > from fabric.api import run, env, execute > from fabric import state > >