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