Module: check_mk
Branch: master
Commit: 055e0e640b6291ca60474d43e85d070c6b03ed03
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=055e0e640b6291…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Mar 26 15:18:43 2019 +0100
check_http: minor refactorings
Change-Id: I443c17cbe0017dc90abb68e89e69f47d399a7a20
---
checks/check_http | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/checks/check_http b/checks/check_http
index 13b5762..933deb3 100644
--- a/checks/check_http
+++ b/checks/check_http
@@ -47,9 +47,9 @@ def _get_family_and_address(settings):
return family, address
-def _get_proxy_setting(settings):
+def _get_proxy(params):
"""return proxys (address, port, auth) or None"""
- proxy = settings.get("proxy")
+ proxy = params.get("proxy")
if not proxy:
return None
@@ -59,7 +59,7 @@ def _get_proxy_setting(settings):
else:
address, port = proxy, None
- auth = settings.get("proxy_auth")
+ auth = params.get("proxy_auth")
if auth:
auth = passwordstore_get_cmdline("%s:%%s" % auth[0], auth[1])
@@ -67,7 +67,7 @@ def _get_proxy_setting(settings):
return proset(address, port, auth)
-def _certificate_args(address_family, address, settings):
+def _certificate_args(address_family, address, proxy, settings):
args = []
server = settings.get('cert_host', address)
@@ -86,7 +86,6 @@ def _certificate_args(address_family, address, settings):
if "sni" in settings:
args += ['--sni']
- proxy = _get_proxy_setting(settings)
server_port = settings.get("port")
specify_port = proxy.port if proxy else server_port
@@ -108,12 +107,11 @@ def _certificate_args(address_family, address, settings):
return args
-def _url_args(address_family, address, settings):
+def _url_args(address_family, address, proxy, settings):
# get virthost settings:
# TODO: when did 'vhost' dissapear from WATO?
vhost, omit_ip = settings.get("virthost", (settings.get("vhost"),
False))
- proxy = _get_proxy_setting(settings)
args = []
@@ -224,10 +222,11 @@ def check_http_arguments(params):
mode_name, settings = params["mode"]
address_family, address = _get_family_and_address(settings)
+ proxy = _get_proxy(settings)
if mode_name == 'cert':
- return _certificate_args(address_family, address, settings)
- return _url_args(address_family, address, settings)
+ return _certificate_args(address_family, address, proxy, settings)
+ return _url_args(address_family, address, proxy, settings)
def check_http_description(params):