Skip to content

Commit

Permalink
Make PagerDuty output idempotent; adds support for responder requests (
Browse files Browse the repository at this point in the history
…#935)

* Alot of changes but requires testing

* i funcional 2nd iteration

* More fixupes

* More improvements

* oh god i have so many tests to fix

* Fixup more tests

* Awesome improvements

* Fixes the tests

* fixup

* Further improves tests and test coverage

* Improve test coverage

* yep

* Coveregae

* mgaoebfalwkejlk

* More test coverage
  • Loading branch information
Ryxias committed May 7, 2019
1 parent 4baf713 commit f1cf85c
Show file tree
Hide file tree
Showing 3 changed files with 1,071 additions and 788 deletions.
10 changes: 7 additions & 3 deletions stream_alert/alert_processor/outputs/output_base.py
Expand Up @@ -43,6 +43,10 @@
class OutputRequestFailure(Exception):
"""OutputRequestFailure handles any HTTP failures"""

def __init__(self, response):
super(OutputRequestFailure, self).__init__()
self.response = response


def retry_on_exception(exceptions):
"""Decorator function to attempt retry based on passed exceptions"""
Expand Down Expand Up @@ -222,7 +226,7 @@ def do_put_request():
resp = cls._put_request(url, params, headers, verify)
success = cls._check_http_response(resp)
if not success:
raise OutputRequestFailure()
raise OutputRequestFailure(resp)

return resp
return do_put_request()
Expand Down Expand Up @@ -263,7 +267,7 @@ def do_get_request():
resp = cls._get_request(url, params, headers, verify)
success = cls._check_http_response(resp)
if not success:
raise OutputRequestFailure()
raise OutputRequestFailure(resp)

return resp
return do_get_request()
Expand Down Expand Up @@ -304,7 +308,7 @@ def do_post_request():
resp = cls._post_request(url, data, headers, verify)
success = cls._check_http_response(resp)
if not success:
raise OutputRequestFailure()
raise OutputRequestFailure(resp)

return resp
return do_post_request()
Expand Down

0 comments on commit f1cf85c

Please sign in to comment.