Module: check_mk
Branch: master
Commit: 5dd5c1442a8b4b286b8872a74c7ff856e4c22126
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5dd5c1442a8b4b…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Apr 1 14:32:43 2019 +0200
apache_status: refactor IV
Change-Id: I7cf22d7c32ca5ef3ff1b2bc06daab9b8506099c4
---
agents/plugins/apache_status | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index 671d30a..658b655 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -140,15 +140,15 @@ def get_response(proto, address, portspec, page):
try:
request = urllib2.Request(url, headers={"Accept":
"text/plain"})
return urllib2.urlopen(request)
- except urllib2.URLError, e:
- if 'unknown protocol' in str(e):
+ except urllib2.URLError as exc:
+ if 'unknown protocol' in str(exc):
# HACK: workaround misconfigurations where port 443 is used for
# serving non ssl secured http
url = 'http://%s%s/server-status?auto' % (address, portspec)
return urllib2.urlopen(url)
raise
- except Exception, e:
- if 'doesn\'t match' in str(e) and is_local:
+ except Exception as exc:
+ if 'doesn\'t match' in str(exc) and is_local:
# HACK: workaround if SSL port is found and localhost is using
# SSL connections but certificate does not match
return urllib2.urlopen(url, context=no_cert_verification())
@@ -181,11 +181,11 @@ def main():
break
sys.stdout.write("%s %s %s\n" % (address, port, line))
- except urllib2.HTTPError, e:
- sys.stderr.write('HTTP-Error (%s%s): %s %s\n' % (address, portspec,
e.code, e))
+ except urllib2.HTTPError as exc:
+ sys.stderr.write('HTTP-Error (%s%s): %s %s\n' % (address, portspec,
exc.code, exc))
- except Exception, e:
- sys.stderr.write('Exception (%s%s): %s\n' % (address, portspec, e))
+ except Exception as exc: # pylint: disable=broad-except
+ sys.stderr.write('Exception (%s%s): %s\n' % (address, portspec,
exc))
return 0