Fix some pylint-detected issues
authorIustin Pop <iustin@google.com>
Tue, 6 Jan 2009 09:57:53 +0000 (09:57 +0000)
committerIustin Pop <iustin@google.com>
Tue, 6 Jan 2009 09:57:53 +0000 (09:57 +0000)
Two bad indentation cases and a missing variable.

Reviewed-by: imsnah

daemons/ganeti-masterd
daemons/ganeti-rapi
lib/http/auth.py
lib/hypervisor/hv_xen.py

index 5e524d9..ff7ec0c 100755 (executable)
@@ -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]
index 4607b0d..9632939 100755 (executable)
@@ -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
 
index 4df4ccb..325ed7f 100644 (file)
@@ -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
index e03bc53..c4aebf3 100644 (file)
@@ -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):