Commit f81eb5ff authored by Eric Zheng's avatar Eric Zheng

add trailing commas and make logging lazy

parent 980b1276
......@@ -57,15 +57,15 @@ class RunPromise(GenericPromise):
except requests.exceptions.SSLError as e:
if 'certificate verify failed' in str(e):
self.logger.error(
"ERROR SSL verify failed while accessing %r" % (url,))
"ERROR SSL verify failed while accessing %r", url)
else:
self.logger.error(
"ERROR Unknown SSL error %r while accessing %r" % (e, url))
"ERROR Unknown SSL error %r while accessing %r", e, url)
except requests.ConnectionError as e:
self.logger.error(
"ERROR connection not possible while accessing %r" % (url, ))
"ERROR connection not possible while accessing %r", url)
except Exception as e:
self.logger.error("ERROR: %s" % (e,))
self.logger.error("ERROR: %s", e)
else:
# Check that the returned status code is what we expected
......@@ -73,12 +73,12 @@ class RunPromise(GenericPromise):
check_secure = int(self.getConfig('check-secure', 0))
if http_code == 401 and check_secure == 1:
self.logger.info("%r is protected (returned %s)." % (url, http_code))
self.logger.info("%r is protected (returned %s).", url, http_code)
elif not ignore_code and http_code != expected_http_code:
self.logger.error("%r is not available (returned %s, expected %s)." % (
url, http_code, expected_http_code))
self.logger.error("%r is not available (returned %s, expected %s).",
url, http_code, expected_http_code)
else:
self.logger.info("%r is available" % (url,))
self.logger.info("%r is available", url)
def sense(self):
"""
......
......@@ -288,7 +288,7 @@ extra_config_dict = {
'timeout': %(timeout)s,
'check-secure': %(check_secure)s,
'ignore-code': %(ignore_code)s,
'http_code': %(http_code)s
'http_code': %(http_code)s,
}
"""
......@@ -298,7 +298,7 @@ extra_config_dict = {
'url': '%(url)s',
'username': '%(username)s',
'password': '%(password)s',
'require-auth': %(require_auth)s
'require-auth': %(require_auth)s,
}
"""
......@@ -532,7 +532,7 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
'url': url,
'username': TEST_GOOD_USERNAME,
'password': TEST_GOOD_PASSWORD,
'require_auth': 1
'require_auth': 1,
}
self.writePromise(self.promise_name, content)
self.configureLauncher()
......@@ -554,7 +554,7 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
'url': url,
'username': TEST_GOOD_USERNAME,
'password': TEST_GOOD_PASSWORD,
'require_auth': 0
'require_auth': 0,
}
self.writePromise(self.promise_name, content)
self.configureLauncher()
......@@ -573,7 +573,7 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
'url': url,
'username': TEST_BAD_USERNAME,
'password': TEST_BAD_PASSWORD,
'require_auth': 1
'require_auth': 1,
}
self.writePromise(self.promise_name, content)
self.configureLauncher()
......@@ -598,7 +598,7 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
'url': url,
'username': TEST_GOOD_USERNAME,
'password': TEST_GOOD_PASSWORD,
'require_auth': 1
'require_auth': 1,
}
self.writePromise(self.promise_name, content)
self.configureLauncher()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment