diff options
author | varac <varac@users.noreply.github.com> | 2014-04-02 21:23:20 +0200 |
---|---|---|
committer | varac <varac@users.noreply.github.com> | 2014-04-02 21:23:20 +0200 |
commit | 7b4f9ad334ec702449fdc683ea8fc312e06b2bd9 (patch) | |
tree | ed163c1078163abb8bd151bc9ae48175eb88538e /test | |
parent | 5d9acb509c8f7f22d19e1a87239244363aaf70e2 (diff) | |
parent | 9cffdf44ad4b398b27a5c9527ce2080ab6ca2b44 (diff) |
Merge pull request #143 from andrejb/bug/5430_fix-soledad_sync-returned-check_name
Fix soledad sync nagios plugin returned check_name (#5430).
Diffstat (limited to 'test')
-rwxr-xr-x | test/nagios/soledad_sync.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/nagios/soledad_sync.py b/test/nagios/soledad_sync.py index 3f176b5..94679b1 100755 --- a/test/nagios/soledad_sync.py +++ b/test/nagios/soledad_sync.py @@ -12,8 +12,10 @@ import os import srp._pysrp as srp import shutil import u1db +import webapp_login + + from u1db.remote.http_target import HTTPSyncTarget -from webapp_login import read_config, parse, authenticate, fail # monkey patch U1DB's HTTPSyncTarget to perform token based auth @@ -30,6 +32,14 @@ HTTPSyncTarget.set_token_credentials = set_token_credentials HTTPSyncTarget._sign_request = _sign_request +def fail(reason): + print '2 soledad_sync - CRITICAL - ' + reason + exit(2) + +# monkey patch webapp_login's fail function to report as soledad +webapp_login.fail = fail + + # The following function could fetch all info needed to sync using soledad. # Despite that, we won't use all that info because we are instead faking a # Soledad sync by using U1DB slightly modified syncing capabilities. Part of @@ -42,7 +52,7 @@ def get_soledad_info(config, tempdir): api = config['api'] usr = srp.User( user['username'], user['password'], srp.SHA256, srp.NG_1024 ) try: - auth = parse(authenticate(api, usr)) + auth = webapp_login.parse(webapp_login.authenticate(api, usr)) except requests.exceptions.ConnectionError: fail('no connection to server') # get soledad server url @@ -65,7 +75,7 @@ def get_soledad_info(config, tempdir): def run_tests(): tempdir = tempfile.mkdtemp() uuid, password, server_url, cert_file, token = \ - get_soledad_info(read_config(), tempdir) + get_soledad_info(webapp_login.read_config(), tempdir) exc = None try: # in the future, we can replace the following by an actual Soledad |