Commit b46261e2 authored by Łukasz Nowak's avatar Łukasz Nowak

promise/plugin: Flake8ize check_url_available

parent 30a6645b
from zope import interface as zope_interface
from slapos.grid.promise import interface
from slapos.grid.promise.generic import GenericPromise
import os
import requests
class RunPromise(GenericPromise):
zope_interface.implements(interface.IPromise)
......@@ -36,7 +37,8 @@ class RunPromise(GenericPromise):
cert = None
try:
result = requests.get(url, verify=verify, allow_redirects=True, timeout=timeout, cert=cert)
result = requests.get(
url, verify=verify, allow_redirects=True, timeout=timeout, cert=cert)
except requests.ConnectionError as e:
self.logger.error(
"ERROR connection not possible while accessing %r" % (url, ))
......@@ -47,7 +49,7 @@ class RunPromise(GenericPromise):
http_code = result.status_code
check_secure = int(self.getConfig('check-secure', 0))
if http_code == 0:
self.logger.error("%s is not available (server not reachable)." % url)
elif http_code == 401 and check_secure == 1:
......
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