diff options
author | Endi S. Dewata <edewata@redhat.com> | 2015-01-30 15:49:27 -0500 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2015-02-05 11:32:20 -0500 |
commit | dfe55982eb50750fc1e65bce312d884b1604f0b4 (patch) | |
tree | 411d1316c3b4ff78e3a349bb4923bd0e2aae03c7 /base/server | |
parent | 8fc5acb72ac9fdbc70b8a6e7242890f9dbeccf56 (diff) | |
download | pki-dfe55982eb50750fc1e65bce312d884b1604f0b4.tar.gz pki-dfe55982eb50750fc1e65bce312d884b1604f0b4.tar.xz pki-dfe55982eb50750fc1e65bce312d884b1604f0b4.zip |
Fixed pylint report.
Previously pylint report was saved it into a file which may not be
accessible on a build system. The pylint-build-scan.sh has been
changed to display the report so it will appear in the build log.
The pylint configuration has also been modified to disable C and R
messages by default. This way when other errors or warnings occur
the build will fail without having to check for specific codes.
Some Python codes have been modified to reduce the number of pylint
warnings.
https://fedorahosted.org/pki/ticket/703
Diffstat (limited to 'base/server')
-rw-r--r-- | base/server/python/pki/server/__init__.py | 4 | ||||
-rw-r--r-- | base/server/python/pki/server/deployment/pkihelper.py | 24 | ||||
-rw-r--r-- | base/server/python/pki/server/deployment/pkiparser.py | 6 | ||||
-rw-r--r-- | base/server/python/pki/server/deployment/pkiscriptlet.py | 4 | ||||
-rw-r--r-- | base/server/python/pki/server/deployment/scriptlets/initialization.py | 2 | ||||
-rwxr-xr-x | base/server/sbin/pki-server-upgrade | 2 | ||||
-rwxr-xr-x | base/server/sbin/pkidestroy | 2 | ||||
-rwxr-xr-x | base/server/sbin/pkispawn | 10 |
8 files changed, 27 insertions, 27 deletions
diff --git a/base/server/python/pki/server/__init__.py b/base/server/python/pki/server/__init__.py index 3c471071f..063acd738 100644 --- a/base/server/python/pki/server/__init__.py +++ b/base/server/python/pki/server/__init__.py @@ -29,8 +29,8 @@ import subprocess import pki INSTANCE_BASE_DIR = '/var/lib/pki' -REGISTRY_DIR = '/etc/sysconfig/pki' -SUBSYSTEM_TYPES = ['ca', 'kra', 'ocsp', 'tks', 'tps'] +REGISTRY_DIR = '/etc/sysconfig/pki' +SUBSYSTEM_TYPES = ['ca', 'kra', 'ocsp', 'tks', 'tps'] class PKISubsystem(object): diff --git a/base/server/python/pki/server/deployment/pkihelper.py b/base/server/python/pki/server/deployment/pkihelper.py index 02a2c9e32..ec0f0a2d4 100644 --- a/base/server/python/pki/server/deployment/pkihelper.py +++ b/base/server/python/pki/server/deployment/pkihelper.py @@ -925,13 +925,13 @@ class Instance: # present within the PKI 'tomcat' registry directory for instance in os.listdir( self.mdict['pki_instance_type_registry_path']): - if os.path.isdir( - os.path.join( - self.mdict['pki_instance_type_registry_path'], + if os.path.isdir(\ + os.path.join(\ + self.mdict['pki_instance_type_registry_path'],\ instance)) and not\ - os.path.islink( - os.path.join( - self.mdict['pki_instance_type_registry_path'], + os.path.islink(\ + os.path.join(\ + self.mdict['pki_instance_type_registry_path'],\ instance)): rv += 1 config.pki_log.debug(log.PKIHELPER_TOMCAT_INSTANCES_2, @@ -987,7 +987,7 @@ class Instance: # catching all exceptions because we do not want to break if underlying # requests or urllib3 use a different exception. # If the connection fails, we will time out in any case - # pylint: disable-msg=W0703 + # pylint: disable=W0703 try: client = pki.system.SystemStatusClient(connection) response = client.get_status() @@ -1739,7 +1739,7 @@ class File: extra=config.PKI_INDENTATION_LEVEL_2) open(name, "w").close() with open(name, "w") as FILE: - noise = ''.join(random.choice(string.ascii_letters + + noise = ''.join(random.choice(string.ascii_letters +\ string.digits) for x in range(random_bytes)) FILE.write(noise) # chmod <perms> <name> @@ -2656,7 +2656,7 @@ class KRAConnector: # get a list of all the CA's in the security domain # noinspection PyBroadException - # pylint: disable-msg=W0703 + # pylint: disable=W0703 sechost = cs_cfg.get('securitydomain.host') secport = cs_cfg.get('securitydomain.httpsadminport') try: @@ -2676,7 +2676,7 @@ class KRAConnector: # the auth is not successful or servers are down. In the # worst case, we will time out anyways. # noinspection PyBroadException - # pylint: disable-msg=W0703 + # pylint: disable=W0703 try: self.execute_using_sslget( ca_port, ca_host, subsystemnick, @@ -3675,8 +3675,8 @@ class ConfigClient: with open(self.mdict['pki_external_admin_csr_path'], "w") as f: f.write("-----BEGIN CERTIFICATE REQUEST-----\n") admin_certreq = None - with open(os.path.join( - self.mdict['pki_client_database_dir'], + with open(os.path.join(\ + self.mdict['pki_client_database_dir'],\ "admin_pkcs10.bin.asc"), "r") as f: admin_certreq = f.read() with open(self.mdict['pki_external_admin_csr_path'], "a") as f: diff --git a/base/server/python/pki/server/deployment/pkiparser.py b/base/server/python/pki/server/deployment/pkiparser.py index 92d3e66ba..1e3912084 100644 --- a/base/server/python/pki/server/deployment/pkiparser.py +++ b/base/server/python/pki/server/deployment/pkiparser.py @@ -619,7 +619,7 @@ class PKIConfigParser: # and add this to the "sensitive" key value pairs read in from # the configuration file self.mdict['pki_one_time_pin'] = \ - ''.join(random.choice(string.ascii_letters + string.digits) + ''.join(random.choice(string.ascii_letters + string.digits)\ for x in range(20)) if self.mdict['pki_subsystem'] in\ config.PKI_TOMCAT_SUBSYSTEMS: @@ -1118,8 +1118,8 @@ class PKIConfigParser: # Stand-alone PKI self.mdict['pki_security_domain_type'] = "new" self.mdict['pki_issuing_ca'] = "External CA" - elif (config.pki_subsystem != "CA" or - config.str2bool(self.mdict['pki_clone']) or + elif (config.pki_subsystem != "CA" or\ + config.str2bool(self.mdict['pki_clone']) or\ config.str2bool(self.mdict['pki_subordinate'])): # PKI KRA, PKI OCSP, PKI RA, PKI TKS, PKI TPS, # CA Clone, KRA Clone, OCSP Clone, TKS Clone, TPS Clone diff --git a/base/server/python/pki/server/deployment/pkiscriptlet.py b/base/server/python/pki/server/deployment/pkiscriptlet.py index 2bf4d0750..c446c18f8 100644 --- a/base/server/python/pki/server/deployment/pkiscriptlet.py +++ b/base/server/python/pki/server/deployment/pkiscriptlet.py @@ -27,14 +27,14 @@ import abc class AbstractBasePkiScriptlet(object): __metaclass__ = abc.ABCMeta - # pylint: disable-msg=W0613 + # pylint: disable=W0613 @abc.abstractmethod def spawn(self, deployer): """Retrieve data from the specified PKI dictionary and use it to install a new PKI instance.""" return - # pylint: disable-msg=W0613 + # pylint: disable=W0613 @abc.abstractmethod def destroy(self, deployer): """Retrieve data from the specified PKI dictionary and diff --git a/base/server/python/pki/server/deployment/scriptlets/initialization.py b/base/server/python/pki/server/deployment/scriptlets/initialization.py index 632e21d8e..48b120c46 100644 --- a/base/server/python/pki/server/deployment/scriptlets/initialization.py +++ b/base/server/python/pki/server/deployment/scriptlets/initialization.py @@ -49,7 +49,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): else: config.pki_log.info(log.INITIALIZATION_SPAWN_1, __name__, extra=config.PKI_INDENTATION_LEVEL_1) - if (deployer.mdict['pki_subsystem'] == "CA" or + if (deployer.mdict['pki_subsystem'] == "CA" or\ config.str2bool(deployer.mdict['pki_standalone'])) and\ config.str2bool(deployer.mdict['pki_external_step_two']): # verify that this External CA (Step 2), or Stand-alone PKI diff --git a/base/server/sbin/pki-server-upgrade b/base/server/sbin/pki-server-upgrade index 212fc2675..d149bc045 100755 --- a/base/server/sbin/pki-server-upgrade +++ b/base/server/sbin/pki-server-upgrade @@ -28,7 +28,7 @@ import pki.upgrade import pki.server.upgrade -# pylint: disable-msg=W0613 +# pylint: disable=W0613 def interrupt_handler(event, frame): print print diff --git a/base/server/sbin/pkidestroy b/base/server/sbin/pkidestroy index f0fa27a00..dbd658a20 100755 --- a/base/server/sbin/pkidestroy +++ b/base/server/sbin/pkidestroy @@ -50,7 +50,7 @@ error was: #Handle the Keyboard Interrupt -# pylint: disable-msg=W0613 +# pylint: disable=W0613 def interrupt_handler(event, frame): print print '\nUninstallation canceled.' diff --git a/base/server/sbin/pkispawn b/base/server/sbin/pkispawn index 04eec6ab9..45789fe87 100755 --- a/base/server/sbin/pkispawn +++ b/base/server/sbin/pkispawn @@ -53,7 +53,7 @@ error was: # Handle the Keyboard Interrupt -# pylint: disable-msg=W0613 +# pylint: disable=W0613 def interrupt_handler(event, frame): print print '\nInstallation canceled.' @@ -505,7 +505,7 @@ def main(argv): instance = scriptlet.PkiScriptlet() try: rv = instance.spawn(deployer) - # pylint: disable-msg=W0703 + # pylint: disable=W0703 except Exception: log_error_details() print @@ -546,9 +546,9 @@ def print_install_information(mdict): % mdict['pki_client_database_dir'] print log.PKI_CHECK_STATUS_MESSAGE % mdict['pki_instance_name'] print log.PKI_INSTANCE_RESTART_MESSAGE % mdict['pki_instance_name'] - if (((config.pki_subsystem == "KRA" or - config.pki_subsystem == "OCSP") and - config.str2bool(mdict['pki_standalone'])) and + if (((config.pki_subsystem == "KRA" or\ + config.pki_subsystem == "OCSP") and\ + config.str2bool(mdict['pki_standalone'])) and\ not config.str2bool(mdict['pki_external_step_two'])): # Stand-alone PKI KRA/OCSP (External CA Step 1) print log.PKI_CONFIGURATION_STANDALONE_1 % config.pki_subsystem |