Update patator.py

HI, this a bit more descriptive, when get xxx/unexpected HTTP response, this show what host is "down", and this avoid need to recheck server with curl/wget/etc

for example now when connection to server fail, will get this mesg
06:31:11 patator    FAIL - xxx  17:-1          0.000 | admin                              |    10 | Failed to connect

btw thanks for great tool :)
best regards
pull/4/head
doomedraven 10 years ago
parent 5a140c1501
commit 46731d4949

@ -1592,8 +1592,12 @@ Please read the README inside for more examples and usage information.
#logger.exception(exc_info()[1])
logger.debug('except: %s' % mesg)
resp = self.module.Response('xxx', mesg)
if str(e_value).find('Failed to connect'):
logger.debug('except: %s' % mesg)
resp = self.module.Response('xxx', 'Failed to connect')
else:
logger.debug('except: %s' % mesg)
resp = self.module.Response('xxx', mesg)
if hasattr(module, 'reset'):
module.reset()
@ -1602,6 +1606,7 @@ Please read the README inside for more examples and usage information.
continue
else:
actions = {'fail': None}
@ -3093,6 +3098,9 @@ class Response_HTTP(Response_Base):
def __str__(self):
lines = re.findall('^(HTTP/.+)$', self.mesg, re.M)
if self.mesg.find('Failed to connect to'):
return 'Failed to connect'
if not lines:
return 'Unexpected HTTP response'
else:

Loading…
Cancel
Save