Commit e09fdcfa authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix some pylint-detected issues

Two bad indentation cases and a missing variable.

Reviewed-by: imsnah
parent 5b099da9
......@@ -402,9 +402,9 @@ def CheckAgreement():
continue
break
if retries == 0:
logging.critical("Cluster inconsistent, most of the nodes didn't answer"
" after multiple retries. Aborting startup")
return False
logging.critical("Cluster inconsistent, most of the nodes didn't answer"
" after multiple retries. Aborting startup")
return False
# here a real node is at the top of the list
all_votes = sum(item[1] for item in votes)
top_node, top_votes = votes[0]
......
......@@ -134,6 +134,7 @@ class RemoteApiHttpServer(http.auth.HttpServerRequestAuthentication,
if sn:
req.response_headers[http.HTTP_ETAG] = str(sn)
except:
method = req.request_method.upper()
logging.exception("Error while handling the %s request", method)
raise
......
......@@ -166,19 +166,19 @@ class HttpServerRequestAuthentication(object):
# Unsupported authentication scheme
return False
def _CheckBasicAuthorization(self, req, input):
def _CheckBasicAuthorization(self, req, in_data):
"""Checks credentials sent for basic authentication.
@type req: L{http.server._HttpServerRequest}
@param req: HTTP request context
@type input: str
@param input: Username and password encoded as Base64
@type in_data: str
@param in_data: Username and password encoded as Base64
@rtype: bool
@return: Whether user is allowed to execute request
"""
try:
creds = base64.b64decode(input.encode('ascii')).decode('ascii')
creds = base64.b64decode(in_data.encode('ascii')).decode('ascii')
except (TypeError, binascii.Error, UnicodeError):
logging.exception("Error when decoding Basic authentication credentials")
return False
......
......@@ -461,10 +461,10 @@ class XenHvmHypervisor(XenHypervisor):
# hvm_cdrom_image_path verification
iso_path = hvparams[constants.HV_CDROM_IMAGE_PATH]
if iso_path and not os.path.isfile(iso_path):
raise errors.HypervisorError("The HVM CDROM image must either be a"
" regular file or a symlink pointing to"
" an existing regular file, not %s" %
iso_path)
raise errors.HypervisorError("The HVM CDROM image must either be a"
" regular file or a symlink pointing to"
" an existing regular file, not %s" %
iso_path)
@classmethod
def _WriteConfigFile(cls, instance, block_devices, extra_args):
......
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