Ankur Agrawal
2016-01-16 00:58:48 UTC
I am trying to catch Abort exception. When I use fabric run(...) method,
the host it tries to connect is not available and so it aborts with connect
time out exception. I am not able to catch it. Following is a two different
ways of code snippet-
First I try following -
class FabricException(Exception):
pass
with settings(abort_exception = FabricException):
try:
output = run(command)
except FabricException:
print 'inside exception'
LOG.debug("inside exception")
It didn't go in exception block. Instead it threw -
NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net
(tried 1 time)
Aborting.
SystemExit: 1
Then I try to continue even if exception -
command = 'ls -l'
with settings(warn_only = True):
output = run(command)
Still it threw the same exception
NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net
(tried 1 time)
Aborting.
SystemExit: 1
Appreciate if somebody tell if I am missing anything ?
Thanks,
Ankur
the host it tries to connect is not available and so it aborts with connect
time out exception. I am not able to catch it. Following is a two different
ways of code snippet-
First I try following -
class FabricException(Exception):
pass
with settings(abort_exception = FabricException):
try:
output = run(command)
except FabricException:
print 'inside exception'
LOG.debug("inside exception")
It didn't go in exception block. Instead it threw -
NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net
(tried 1 time)
Aborting.
SystemExit: 1
Then I try to continue even if exception -
command = 'ls -l'
with settings(warn_only = True):
output = run(command)
Still it threw the same exception
NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net
(tried 1 time)
Aborting.
SystemExit: 1
Appreciate if somebody tell if I am missing anything ?
Thanks,
Ankur