]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix linter complaints
authorJohn Spray <john.spray@redhat.com>
Fri, 27 Apr 2018 10:56:21 +0000 (06:56 -0400)
committerJohn Spray <john.spray@redhat.com>
Mon, 30 Apr 2018 13:27:49 +0000 (14:27 +0100)
In addition to line ordering, there were a couple of bogus ones:
E: 30, 0: No name 'version' in module 'distutils' (no-name-in-module)
E: 30, 0: Unable to import 'distutils.version' (import-error)
E: 36, 8: No name 'wsgiserver' in module 'cherrypy' (no-name-in-module)
E: 36, 8: Unable to import 'cherrypy.wsgiserver.wsgiserver2' (import-error)

I don't know why pylint can't see these modules, but they're definitely
there, so I've added them to the ignored list in .pylintrc

Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/mgr/dashboard/.pylintrc
src/pybind/mgr/dashboard/module.py

index 96f88facc3fd704f3bc8f615c490d25ddef3b4a8..b3616b4c876cab0151b3723d428fc0aacd7382f9 100644 (file)
@@ -407,7 +407,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local
 # (useful for modules/projects where namespaces are manipulated during runtime
 # and thus existing member attributes cannot be deduced by static analysis. It
 # supports qualified module names, as well as Unix pattern matching.
-ignored-modules=
+ignored-modules=cherrypy,distutils
 
 # Show a hint with possible names when a member name was not found. The aspect
 # of finding the hint is based on edit distance.
index 8e7c16a20e83f89082901c831725b8913feba8dd..8f4a542e06223e6c69654f58eb84f50c788fd61a 100644 (file)
@@ -5,13 +5,17 @@ openATTIC mgr plugin (based on CherryPy)
 from __future__ import absolute_import
 
 import errno
+from distutils.version import StrictVersion
 import os
 import socket
 import tempfile
 import threading
 from uuid import uuid4
+
 from OpenSSL import crypto
 
+from mgr_module import MgrModule, MgrStandbyModule
+
 try:
     from urlparse import urljoin
 except ImportError:
@@ -27,7 +31,6 @@ except ImportError:
 # The SSL code in CherryPy 3.5.0 is buggy.  It was fixed long ago,
 # but 3.5.0 is still shipping in major linux distributions
 # (Fedora 27, Ubuntu Xenial), so we must monkey patch it to get SSL working.
-from distutils.version import StrictVersion
 if cherrypy is not None:
     v = StrictVersion(cherrypy.__version__)
     # It was fixed in 3.7.0.  Exact lower bound version is probably earlier,
@@ -35,6 +38,7 @@ if cherrypy is not None:
     if v >= StrictVersion("3.5.0") and v < StrictVersion("3.7.0"):
         from cherrypy.wsgiserver.wsgiserver2 import HTTPConnection,\
                                                     CP_fileobject
+
         def fixed_init(hc_self, server, sock, makefile=CP_fileobject):
             hc_self.server = server
             hc_self.socket = sock
@@ -45,8 +49,6 @@ if cherrypy is not None:
         HTTPConnection.__init__ = fixed_init
 
 
-from mgr_module import MgrModule, MgrStandbyModule
-
 if 'COVERAGE_ENABLED' in os.environ:
     import coverage
     _cov = coverage.Coverage(config_file="{}/.coveragerc".format(os.path.dirname(__file__)))
@@ -93,6 +95,9 @@ class SSLCherryPyConfig(object):
         self._stopping = threading.Event()
         self._url_prefix = ""
 
+        self.cert_tmp = None
+        self.pkey_tmp = None
+
     def shutdown(self):
         self._stopping.set()
 
@@ -191,6 +196,7 @@ class SSLCherryPyConfig(object):
                 self.log.info("Configured CherryPy, starting engine...")
                 return uri
 
+
 class Module(MgrModule, SSLCherryPyConfig):
     """
     dashboard module entrypoint