Fix for missing Healthchecks monitoring payload or HTTP 500 due to incorrect unicode encoding (#260).
This commit is contained in:
parent
4385f2a36a
commit
c4aa34bf5c
4 changed files with 14 additions and 9 deletions
3
NEWS
3
NEWS
|
@ -1,3 +1,6 @@
|
||||||
|
1.4.16
|
||||||
|
* Fix for missing Healthchecks monitoring payload or HTTP 500 due to incorrect unicode encoding.
|
||||||
|
|
||||||
1.4.15
|
1.4.15
|
||||||
* Fix for database dump removal incorrectly skipping some database dumps.
|
* Fix for database dump removal incorrectly skipping some database dumps.
|
||||||
* #123: Support for mounting an archive as a FUSE filesystem via "borgmatic mount" action, and
|
* #123: Support for mounting an archive as a FUSE filesystem via "borgmatic mount" action, and
|
||||||
|
|
|
@ -97,4 +97,4 @@ def ping_monitor(ping_url_or_uuid, config_filename, state, dry_run):
|
||||||
|
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
logging.getLogger('urllib3').setLevel(logging.ERROR)
|
logging.getLogger('urllib3').setLevel(logging.ERROR)
|
||||||
requests.post(ping_url, data=payload)
|
requests.post(ping_url, data=payload.encode('utf-8'))
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -1,6 +1,6 @@
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
VERSION = '1.4.15'
|
VERSION = '1.4.16'
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
|
@ -60,7 +60,7 @@ def test_ping_monitor_hits_ping_url_for_start_state():
|
||||||
flexmock(module).should_receive('Forgetful_buffering_handler')
|
flexmock(module).should_receive('Forgetful_buffering_handler')
|
||||||
ping_url = 'https://example.com'
|
ping_url = 'https://example.com'
|
||||||
flexmock(module.requests).should_receive('post').with_args(
|
flexmock(module.requests).should_receive('post').with_args(
|
||||||
'{}/{}'.format(ping_url, 'start'), data=''
|
'{}/{}'.format(ping_url, 'start'), data=''.encode('utf-8')
|
||||||
)
|
)
|
||||||
|
|
||||||
module.ping_monitor(ping_url, 'config.yaml', state=module.monitor.State.START, dry_run=False)
|
module.ping_monitor(ping_url, 'config.yaml', state=module.monitor.State.START, dry_run=False)
|
||||||
|
@ -68,19 +68,21 @@ def test_ping_monitor_hits_ping_url_for_start_state():
|
||||||
|
|
||||||
def test_ping_monitor_hits_ping_url_for_finish_state():
|
def test_ping_monitor_hits_ping_url_for_finish_state():
|
||||||
ping_url = 'https://example.com'
|
ping_url = 'https://example.com'
|
||||||
payload = flexmock()
|
payload = 'data'
|
||||||
flexmock(module).should_receive('format_buffered_logs_for_payload').and_return(payload)
|
flexmock(module).should_receive('format_buffered_logs_for_payload').and_return(payload)
|
||||||
flexmock(module.requests).should_receive('post').with_args(ping_url, data=payload)
|
flexmock(module.requests).should_receive('post').with_args(
|
||||||
|
ping_url, data=payload.encode('utf-8')
|
||||||
|
)
|
||||||
|
|
||||||
module.ping_monitor(ping_url, 'config.yaml', state=module.monitor.State.FINISH, dry_run=False)
|
module.ping_monitor(ping_url, 'config.yaml', state=module.monitor.State.FINISH, dry_run=False)
|
||||||
|
|
||||||
|
|
||||||
def test_ping_monitor_hits_ping_url_for_fail_state():
|
def test_ping_monitor_hits_ping_url_for_fail_state():
|
||||||
ping_url = 'https://example.com'
|
ping_url = 'https://example.com'
|
||||||
payload = flexmock()
|
payload = 'data'
|
||||||
flexmock(module).should_receive('format_buffered_logs_for_payload').and_return(payload)
|
flexmock(module).should_receive('format_buffered_logs_for_payload').and_return(payload)
|
||||||
flexmock(module.requests).should_receive('post').with_args(
|
flexmock(module.requests).should_receive('post').with_args(
|
||||||
'{}/{}'.format(ping_url, 'fail'), data=payload
|
'{}/{}'.format(ping_url, 'fail'), data=payload.encode('utf')
|
||||||
)
|
)
|
||||||
|
|
||||||
module.ping_monitor(ping_url, 'config.yaml', state=module.monitor.State.FAIL, dry_run=False)
|
module.ping_monitor(ping_url, 'config.yaml', state=module.monitor.State.FAIL, dry_run=False)
|
||||||
|
@ -88,10 +90,10 @@ def test_ping_monitor_hits_ping_url_for_fail_state():
|
||||||
|
|
||||||
def test_ping_monitor_with_ping_uuid_hits_corresponding_url():
|
def test_ping_monitor_with_ping_uuid_hits_corresponding_url():
|
||||||
ping_uuid = 'abcd-efgh-ijkl-mnop'
|
ping_uuid = 'abcd-efgh-ijkl-mnop'
|
||||||
payload = flexmock()
|
payload = 'data'
|
||||||
flexmock(module).should_receive('format_buffered_logs_for_payload').and_return(payload)
|
flexmock(module).should_receive('format_buffered_logs_for_payload').and_return(payload)
|
||||||
flexmock(module.requests).should_receive('post').with_args(
|
flexmock(module.requests).should_receive('post').with_args(
|
||||||
'https://hc-ping.com/{}'.format(ping_uuid), data=payload
|
'https://hc-ping.com/{}'.format(ping_uuid), data=payload.encode('utf-8')
|
||||||
)
|
)
|
||||||
|
|
||||||
module.ping_monitor(ping_uuid, 'config.yaml', state=module.monitor.State.FINISH, dry_run=False)
|
module.ping_monitor(ping_uuid, 'config.yaml', state=module.monitor.State.FINISH, dry_run=False)
|
||||||
|
|
Loading…
Reference in a new issue