From e09fdcfa387308b2740dea9a5609a106e58c8876 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 6 Jan 2009 09:57:53 +0000
Subject: [PATCH] Fix some pylint-detected issues

Two bad indentation cases and a missing variable.

Reviewed-by: imsnah
---
 daemons/ganeti-masterd   | 6 +++---
 daemons/ganeti-rapi      | 1 +
 lib/http/auth.py         | 8 ++++----
 lib/hypervisor/hv_xen.py | 8 ++++----
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd
index 5e524d98e..ff7ec0c31 100755
--- a/daemons/ganeti-masterd
+++ b/daemons/ganeti-masterd
@@ -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]
diff --git a/daemons/ganeti-rapi b/daemons/ganeti-rapi
index 4607b0d15..963293973 100755
--- a/daemons/ganeti-rapi
+++ b/daemons/ganeti-rapi
@@ -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
 
diff --git a/lib/http/auth.py b/lib/http/auth.py
index 4df4ccb2d..325ed7f63 100644
--- a/lib/http/auth.py
+++ b/lib/http/auth.py
@@ -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
diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index e03bc53eb..c4aebf382 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -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):
-- 
GitLab