[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pki-devel] [PATCH] 62, 63, 64 Fixes to issues reported by pylint



Please review the patches with fixes to errors reported by pylint in Dogtag 10.

--Abhishek
From 867a8ca6f621bbec72d5758aaaaa5bf8ccca91ec Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru redhat com>
Date: Fri, 28 Jun 2013 15:24:11 -0400
Subject: [PATCH 87/89] Fixes for issues reported by pylint.

Fixes for issues in pkihelper.py.
Ticket #316
---
 base/server/src/engine/pkihelper.py    |  116 +++++++++++++++-----------------
 base/server/src/engine/pkiscriptlet.py |    4 +-
 2 files changed, 57 insertions(+), 63 deletions(-)

diff --git a/base/server/src/engine/pkihelper.py b/base/server/src/engine/pkihelper.py
index 009c76e3d31312381ca26a84c9d6ce412bdd09f9..18b7f08fb8872d4b31d3195832aad35f9ec74497 100644
--- a/base/server/src/engine/pkihelper.py
+++ b/base/server/src/engine/pkihelper.py
@@ -25,11 +25,11 @@ import errno
 import sys
 import os
 import fileinput
-import pickle
 import random
 import re
 import requests
 import shutil
+from shutil import Error, WindowsError
 import string
 import subprocess
 import time
@@ -82,7 +82,7 @@ def pki_copytree(src, dst, symlinks=False, ignore=None):
     list of names relative to the `src` directory that should
     not be copied.
 
-    XXX Consider this example code rather than the ultimate tool.
+    *** Consider this example code rather than the ultimate tool.
 
     """
     names = os.listdir(src)
@@ -791,18 +791,18 @@ class ConfigurationFile:
         return
 
     def populate_non_default_ports(self):
-        if self.master_dict['pki_http_port'] != \
-            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_HTTP_PORT):
-                ports.append(self.master_dict['pki_http_port'])
-        if self.master_dict['pki_https_port'] != \
-            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_HTTPS_PORT):
-                ports.append(self.master_dict['pki_https_port'])
-        if self.master_dict['pki_tomcat_server_port'] != \
-            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_SERVER_PORT):
-                ports.append(self.master_dict['pki_tomcat_server_port'])
-        if self.master_dict['pki_ajp_port'] != \
-            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_AJP_PORT):
-                ports.append(self.master_dict['pki_ajp_port'])
+        if (self.master_dict['pki_http_port'] != 
+            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_HTTP_PORT)):
+            ports.append(self.master_dict['pki_http_port'])
+        if (self.master_dict['pki_https_port'] !=
+            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_HTTPS_PORT)):
+            ports.append(self.master_dict['pki_https_port'])
+        if (self.master_dict['pki_tomcat_server_port'] !=
+            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_SERVER_PORT)):
+            ports.append(self.master_dict['pki_tomcat_server_port'])
+        if (self.master_dict['pki_ajp_port'] != 
+            str(config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_AJP_PORT)):
+            ports.append(self.master_dict['pki_ajp_port'])
         return
 
     def verify_selinux_ports(self):
@@ -822,10 +822,10 @@ class ConfigurationFile:
         for port in portlist:
             context = ""
             for i in portrecs:
-                if portrecs[i][0] == "unreserved_port_t" or \
-                   portrecs[i][0] == "reserved_port_t" or \
-                   i[2] != "tcp":
-                       continue
+                if (portrecs[i][0] == "unreserved_port_t" or
+                    portrecs[i][0] == "reserved_port_t" or
+                    i[2] != "tcp"):
+                    continue
                 if i[0] <= int(port) and int(port) <= i[1]:
                     context = portrecs[i][0]
                     break
@@ -953,13 +953,13 @@ class Instance:
                 if os.path.isdir(os.path.join(self.master_dict['pki_path'], instance))\
                    and not\
                    os.path.islink(os.path.join(self.master_dict['pki_path'], instance)):
-                    dir = os.path.join(self.master_dict['pki_path'], instance)
+                    instance_dir = os.path.join(self.master_dict['pki_path'], instance)
                     # Since ANY directory within this PKI instance COULD
                     # be a PKI subsystem, look for all possible
                     # PKI subsystems within this PKI instance
-                    for name in os.listdir(dir):
-                        if os.path.isdir(os.path.join(dir, name)) and\
-                           not os.path.islink(os.path.join(dir, name)):
+                    for name in os.listdir(instance_dir):
+                        if os.path.isdir(os.path.join(instance_dir, name)) and\
+                           not os.path.islink(os.path.join(instance_dir, name)):
                             if name.upper() in config.PKI_SUBSYSTEMS:
                                 rv = rv + 1
             config.pki_log.debug(log.PKIHELPER_PKI_INSTANCE_SUBSYSTEMS_2,
@@ -979,8 +979,8 @@ class Instance:
                 path = self.master_dict['pki_instance_path'] + "/" + subsystem.lower()
                 if os.path.exists(path) and os.path.isdir(path):
                     rv.append(subsystem)
-        except OSErr as e:
-            config.pki_log.error(log.PKI_OSERROR_1, str(e),
+        except OSError as exc:
+            config.pki_log.error(log.PKI_OSERROR_1, exc,
                                  extra=config.PKI_INDENTATION_LEVEL_2)
             raise
         return rv
@@ -1067,7 +1067,7 @@ class Instance:
         status = None
         while status != "running":
             status = self.get_instance_status()
-            time.sleep(1);
+            time.sleep(1)
             stop_time = datetime.today()
             if (stop_time - start_time).total_seconds() >= timeout:
                 break
@@ -1261,20 +1261,20 @@ class Directory:
                         for name in files:
                             entity = os.path.join(root, name)
                             if not os.path.islink(entity):
-                                file = entity
+                                temp_file = entity
                                 config.pki_log.debug(
-                                    log.PKIHELPER_IS_A_FILE_1, file,
+                                    log.PKIHELPER_IS_A_FILE_1, temp_file,
                                     extra=config.PKI_INDENTATION_LEVEL_3)
                                 # chmod <file_perms> <name>
                                 config.pki_log.debug(log.PKIHELPER_CHMOD_2,
-                                    file_perms, file,
+                                    file_perms, temp_file,
                                     extra=config.PKI_INDENTATION_LEVEL_3)
-                                os.chmod(file, file_perms)
+                                os.chmod(temp_file, file_perms)
                                 # chown <uid>:<gid> <name>
                                 config.pki_log.debug(log.PKIHELPER_CHOWN_3,
-                                    uid, gid, file,
+                                    uid, gid, temp_file,
                                     extra=config.PKI_INDENTATION_LEVEL_3)
-                                os.chown(file, uid, gid)
+                                os.chown(temp_file, uid, gid)
                                 # Store record in installation manifest
                                 record = manifest.record()
                                 record.name = name
@@ -1313,20 +1313,20 @@ class Directory:
                                 record.acls = symlink_acls
                                 manifest.database.append(record)
                         for name in dirs:
-                            dir = os.path.join(root, name)
+                            temp_dir = os.path.join(root, name)
                             config.pki_log.debug(
-                                log.PKIHELPER_IS_A_DIRECTORY_1, dir,
+                                log.PKIHELPER_IS_A_DIRECTORY_1, temp_dir,
                                 extra=config.PKI_INDENTATION_LEVEL_3)
                             # chmod <dir_perms> <name>
                             config.pki_log.debug(log.PKIHELPER_CHMOD_2,
-                                dir_perms, dir,
+                                dir_perms, temp_dir,
                                 extra=config.PKI_INDENTATION_LEVEL_3)
-                            os.chmod(dir, dir_perms)
+                            os.chmod(temp_dir, dir_perms)
                             # chown <uid>:<gid> <name>
                             config.pki_log.debug(log.PKIHELPER_CHOWN_3,
-                                uid, gid, dir,
+                                uid, gid, temp_dir,
                                 extra=config.PKI_INDENTATION_LEVEL_3)
-                            os.chown(dir, uid, gid)
+                            os.chown(temp_dir, uid, gid)
                             # Store record in installation manifest
                             record = manifest.record()
                             record.name = name
@@ -1759,19 +1759,19 @@ class File:
                 raise
         return
 
-    def generate_noise_file(self, name, bytes, uid=None, gid=None,
+    def generate_noise_file(self, name, random_bytes, uid=None, gid=None,
             perms=config.PKI_DEPLOYMENT_DEFAULT_FILE_PERMISSIONS,
             acls=None, critical_failure=True):
         try:
             if not os.path.exists(name):
                 # generating noise file called <name> and
-                # filling it with <bytes> random bytes
-                config.pki_log.info(log.PKIHELPER_NOISE_FILE_2, name, bytes,
+                # filling it with <random_bytes> random bytes
+                config.pki_log.info(log.PKIHELPER_NOISE_FILE_2, name, random_bytes,
                                     extra=config.PKI_INDENTATION_LEVEL_2)
                 open(name, "w").close()
                 with open(name, "w") as FILE:
                     noise = ''.join(random.choice(string.ascii_letters + \
-                                    string.digits) for x in range(bytes))
+                                    string.digits) for x in range(random_bytes))
                     FILE.write(noise)
                 # chmod <perms> <name>
                 config.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name,
@@ -2033,7 +2033,6 @@ class Password:
                         else:
                             fd.write(self.master_dict['pki_self_signed_token'] + \
                                      "=" + str(pin))
-                    fd.closed
             else:
                 config.pki_log.info(log.PKIHELPER_PASSWORD_CONF_1, path,
                                     extra=config.PKI_INDENTATION_LEVEL_2)
@@ -2048,7 +2047,6 @@ class Password:
                     else:
                         fd.write(self.master_dict['pki_self_signed_token'] + \
                                  "=" + str(pin))
-                fd.closed
         except OSError as exc:
             config.pki_log.error(log.PKI_OSERROR_1, exc,
                                  extra=config.PKI_INDENTATION_LEVEL_2)
@@ -2067,14 +2065,12 @@ class Password:
                     # overwrite the existing 'pkcs12_password.conf' file
                     with open(path, "wt") as fd:
                         fd.write(self.master_dict['pki_client_pkcs12_password'])
-                    fd.closed
             else:
                 config.pki_log.info(log.PKIHELPER_PASSWORD_CONF_1, path,
                                     extra=config.PKI_INDENTATION_LEVEL_2)
                 # create a new 'pkcs12_password.conf' file
                 with open(path, "wt") as fd:
                     fd.write(self.master_dict['pki_client_pkcs12_password'])
-                fd.closed
         except OSError as exc:
             config.pki_log.error(log.PKI_OSERROR_1, exc,
                                  extra=config.PKI_INDENTATION_LEVEL_2)
@@ -2091,7 +2087,7 @@ class Password:
                 token_name = hardware_token
                 token_pwd = tokens[hardware_token]
             elif tokens.has_key(token_name):
-                   token_pwd = tokens[token_name]
+                token_pwd = tokens[token_name]
 
         if token_pwd is None or token_pwd == '':
             # TODO prompt for this password
@@ -2176,7 +2172,6 @@ class Certutil:
                                   pki_key_database, pki_secmod_database,
                                   token, nickname, password_file=None,
                                   silent=True, critical_failure=True):
-        rv = 0
         try:
             # Compose this "certutil" command
             command = "certutil" + " " + "-L"
@@ -2696,7 +2691,7 @@ class KRAConnector:
 
     def execute_using_sslget(self, caport, cahost, subsystemnick,
       token_pwd, krahost, kraport):
-        urlheader = "https://{}:{}".format(cahost, caport)
+        #urlheader = "https://{}:{}".format(cahost, caport) - unused variable
         updateURL = "/ca/rest/admin/kraconnector/remove"
 
         params = "host=" + str(krahost) + \
@@ -2713,9 +2708,8 @@ class KRAConnector:
         # Execute this "sslget" command
         # Note that sslget will return non-zero value for HTTP code != 200
         # and this will raise an exception
-        output = subprocess.check_output(command,
-                                         stderr=subprocess.STDOUT,
-                                         shell=True)
+        subprocess.check_output(command,stderr=subprocess.STDOUT,
+                                shell=True)
 
 class SecurityDomain:
     """PKI Deployment Security Domain Class"""
@@ -2734,12 +2728,12 @@ class SecurityDomain:
         sport = cs_cfg.get('service.securityDomainPort')
         ncsport = cs_cfg.get('service.non_clientauth_securePort', '')
         sechost = cs_cfg.get('securitydomain.host')
-        httpport = cs_cfg.get('securitydomain.httpport')
+        #httpport = cs_cfg.get('securitydomain.httpport') - Security domain http port
         seceeport = cs_cfg.get('securitydomain.httpseeport')
         secagentport = cs_cfg.get('securitydomain.httpsagentport')
         secadminport = cs_cfg.get('securitydomain.httpsadminport')
         secname = cs_cfg.get('securitydomain.name', 'unknown')
-        secselect = cs_cfg.get('securitydomain.select')
+        #secselect = cs_cfg.get('securitydomain.select') - Selected security domain
         adminsport = cs_cfg.get('pkicreate.admin_secure_port', '')
         typeval = cs_cfg.get('cs.type', '')
         agentsport = cs_cfg.get('pkicreate.agent_secure_port', '')
@@ -2767,9 +2761,9 @@ class SecurityDomain:
                             secname,
                             extra=config.PKI_INDENTATION_LEVEL_2)
         listval = typeval.lower() + "List"
-        urlheader = "https://{}:{}".format(sechost, seceeport)
-        urlagentheader = "https://{}:{}".format(sechost, secagentport)
-        urladminheader = "https://{}:{}".format(sechost, secadminport)
+        #urlheader = "https://{}:{}".format(sechost, seceeport) - Security domain EE URL
+        #urlagentheader = "https://{}:{}".format(sechost, secagentport) - Agent URL
+        #urladminheader = "https://{}:{}".format(sechost, secadminport) - Admin URL
         updateURL = "/ca/agent/ca/updateDomainXML"
 
         params = "name=" + "\"" + self.master_dict['pki_instance_path'] + "\"" + \
@@ -2795,7 +2789,7 @@ class SecurityDomain:
                 output = subprocess.check_output(command,
                                              stderr=subprocess.STDOUT,
                                              shell=True)
-            except subprocess.CalledProcessError as exc:
+            except subprocess.CalledProcessError:
                 config.pki_log.warning(
                     log.PKIHELPER_SECURITY_DOMAIN_UNREACHABLE_1,
                     secname,
@@ -2818,7 +2812,7 @@ class SecurityDomain:
                              output,
                              extra=config.PKI_INDENTATION_LEVEL_2)
         # Search the output for Status
-        status = re.findall("\<Status\>(.*?)\<\/Status\>", output)
+        status = re.findall('<Status>(.*?)</Status>', output)
         if not status:
             config.pki_log.warning(
                 log.PKIHELPER_SECURITY_DOMAIN_UNREACHABLE_1,
@@ -2827,7 +2821,7 @@ class SecurityDomain:
             if critical_failure == True:
                 raise Exception(log.PKIHELPER_SECURITY_DOMAIN_UNREACHABLE_1 % secname)
         elif status[0] != "0":
-            error = re.findall("\<Error\>(.*?)\<\/Error\>", output)
+            error = re.findall('<Error>(.*?)</Error>', output)
             if not error:
                 error = ""
             config.pki_log.warning(
@@ -2942,7 +2936,7 @@ class SecurityDomain:
         cstype = cs_cfg.get('cs.type', '')
         sechost = cs_cfg.get('securitydomain.host')
         secadminport = cs_cfg.get('securitydomain.httpsadminport')
-        secselect = cs_cfg.get('securitydomain.select')
+        #secselect = cs_cfg.get('securitydomain.select') - Selected security domain
 
         command = "/bin/pki -p '{}' -h '{}' -P https -u '{}' -w '{}' -d '{}' "\
                   "securitydomain-get-install-token --hostname {} "\
@@ -3468,7 +3462,7 @@ class ConfigClient:
             if self.master_dict['pki_subsystem'] == "CA"  and\
                config.str2bool(self.master_dict['pki_external_step_two']):
                 # External CA Step 2
-                data.stepTwo = "true";
+                data.stepTwo = "true"
 
     def create_system_cert(self, tag):
         cert = pki.system.SystemCertData()
diff --git a/base/server/src/engine/pkiscriptlet.py b/base/server/src/engine/pkiscriptlet.py
index 28706d01c484199a67dfbb8802a1b52fa3d79365..0f67321a0f37b94fed0c2f83011087771cbb2c2d 100644
--- a/base/server/src/engine/pkiscriptlet.py
+++ b/base/server/src/engine/pkiscriptlet.py
@@ -28,13 +28,13 @@ class AbstractBasePkiScriptlet(object):
     __metaclass__ = abc.ABCMeta
 
     @abc.abstractmethod
-    def spawn(self):
+    def spawn(self, deployer):
         """Retrieve data from the specified PKI dictionary and
            use it to install a new PKI instance."""
         return
 
     @abc.abstractmethod
-    def destroy(self):
+    def destroy(self, deployer):
         """Retrieve data from the specified PKI dictionary and
            use it to destroy an existing PKI instance."""
         return
-- 
1.7.10.2

From f85dfe4023d45c9a8b5f9b5646c87cdf62204196 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru redhat com>
Date: Mon, 1 Jul 2013 10:23:36 -0400
Subject: [PATCH 88/89] Fixes for issues reported by pylint.

Fixes for issues in other files.
Ticket #316
---
 base/common/python/pki/encoder.py            |    2 +-
 base/common/python/pki/util.py               |    6 +++---
 base/server/src/engine/pkiparser.py          |   20 ++++++++++----------
 base/server/src/pkidestroy                   |    2 +-
 base/server/src/pkispawn                     |    2 +-
 base/server/src/scriptlets/initialization.py |    2 +-
 base/server/src/scriptlets/selinux_setup.py  |   16 ++++++++--------
 7 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/base/common/python/pki/encoder.py b/base/common/python/pki/encoder.py
index 7fee57e7106adf841b9d3dd3f58d8eb4843d6ee7..c100be3d50a62e8d951fd2c1a91a4a9cc9fd129a 100644
--- a/base/common/python/pki/encoder.py
+++ b/base/common/python/pki/encoder.py
@@ -16,7 +16,7 @@ class CustomTypeEncoder(json.JSONEncoder):
     def default(self, obj):
         for k, v in TYPES.items():
             if isinstance(obj, v):
-                return { k: obj.__dict__ }
+                return {k: obj.__dict__}
         for k, v in NOTYPES.items():
             if isinstance(obj, v):
                 return obj.__dict__
diff --git a/base/common/python/pki/util.py b/base/common/python/pki/util.py
index 7db4fbe79f925715b915c76c6d2748aabfbdadf1..9b501a3420fd38a46ffa1fd0e95b32f379270ecd 100644
--- a/base/common/python/pki/util.py
+++ b/base/common/python/pki/util.py
@@ -25,9 +25,9 @@ import shutil
 
 def copyfile(source, dest):
 
-    dir = os.path.dirname(dest)
-    if not os.path.exists(dir):
-        os.makedirs(dir)
+    dest_dir = os.path.dirname(dest)
+    if not os.path.exists(dest_dir):
+        os.makedirs(dest_dir)
 
     shutil.copy2(source, dest)
     st = os.stat(source)
diff --git a/base/server/src/engine/pkiparser.py b/base/server/src/engine/pkiparser.py
index 7ad8ad3fea84692c7a02175e76faed235eeae438..2ed0cba7850c9f5e500ebcc4aad76cf46693546d 100644
--- a/base/server/src/engine/pkiparser.py
+++ b/base/server/src/engine/pkiparser.py
@@ -53,7 +53,7 @@ class PKIConfigParser:
     def __init__(self, description, epilog):
         self.pki_config = None
 
-        "Read and process command-line options"
+        #Read and process command-line options
         self.arg_parser = argparse.ArgumentParser(
                      description=description,
                      add_help=False,
@@ -92,7 +92,7 @@ class PKIConfigParser:
         self.pki_slots_dict = dict()
 
     # PKI Deployment Helper Functions
-    def process_command_line_arguments(self, argv):
+    def process_command_line_arguments(self):
 
         # Parse command-line options
         args = self.arg_parser.parse_args()
@@ -133,7 +133,7 @@ class PKIConfigParser:
                       config.pki_root_prefix
                 print
                 self.arg_parser.print_help()
-                self.arg_parser.exit(-1);
+                self.arg_parser.exit(-1)
 
         # always default that configuration file exists
         if not os.path.exists(config.default_deployment_cfg) or\
@@ -143,7 +143,7 @@ class PKIConfigParser:
                   config.default_deployment_cfg
             print
             self.arg_parser.print_help()
-            self.arg_parser.exit(-1);
+            self.arg_parser.exit(-1)
 
         if config.user_deployment_cfg:
             # verify user configuration file exists
@@ -153,8 +153,8 @@ class PKIConfigParser:
                       log.PKI_FILE_MISSING_OR_NOT_A_FILE_1 % \
                       config.user_deployment_cfg
                 print
-                parser.arg_parser.print_help()
-                parser.arg_parser.exit(-1);
+                self.arg_parser.print_help()
+                self.arg_parser.exit(-1)
 
 
     def init_config(self):
@@ -201,7 +201,7 @@ class PKIConfigParser:
         config.user_config.optionxform = str
 
         with open(config.default_deployment_cfg) as f:
-                self.pki_config.readfp(f)
+            self.pki_config.readfp(f)
 
         self.flatten_master_dict()
 
@@ -216,7 +216,7 @@ class PKIConfigParser:
                 # First, remove comments:
                 if PKIConfigParser.COMMENT_CHAR in line:
                     # split on comment char, keep only the part before
-                    line, comment = line.split(PKIConfigParser.COMMENT_CHAR, 1)
+                    line, _ = line.split(PKIConfigParser.COMMENT_CHAR, 1)
                 # Second, find lines with an name=value:
                 if PKIConfigParser.OPTION_CHAR in line:
                     # split on name char:
@@ -229,7 +229,7 @@ class PKIConfigParser:
         return values
 
 
-    def set_property(self, section, property, value):
+    def set_property(self, section, property, value): 
         if section != "DEFAULT" and not self.pki_config.has_section(section):
             self.pki_config.add_section(section)
         self.pki_config.set(section, property, value)
@@ -384,7 +384,7 @@ class PKIConfigParser:
 
             return True
 
-        except ldap.NO_SUCH_OBJECT as e:
+        except ldap.NO_SUCH_OBJECT:
             return False
 
     def ds_close(self):
diff --git a/base/server/src/pkidestroy b/base/server/src/pkidestroy
index 16e2b6654f72f49410132444744fb2255d9dcd44..deca8d586602e5927749523160974f9b04240a53 100755
--- a/base/server/src/pkidestroy
+++ b/base/server/src/pkidestroy
@@ -121,7 +121,7 @@ def main(argv):
         help='security domain password file path')
                                  
 
-    args = parser.process_command_line_arguments(argv)
+    args = parser.process_command_line_arguments()
 
     interactive = False
 
diff --git a/base/server/src/pkispawn b/base/server/src/pkispawn
index 78726ea709ecb4266c1229d43a4c1445585db199..75a04b4a6e498ade6910b9487403ec1fbd95811a 100755
--- a/base/server/src/pkispawn
+++ b/base/server/src/pkispawn
@@ -112,7 +112,7 @@ def main(argv):
         help='configuration filename '
             '(MUST specify complete path)')
 
-    args = parser.process_command_line_arguments(argv)
+    args = parser.process_command_line_arguments()
 
     config.default_deployment_cfg = config.PKI_DEPLOYMENT_DEFAULT_CONFIGURATION_FILE
 
diff --git a/base/server/src/scriptlets/initialization.py b/base/server/src/scriptlets/initialization.py
index 80b28a6635c44b6cdb30932106fd317cb997a69b..41e5752029cbe04112ca6c2498820002786bfcaa 100644
--- a/base/server/src/scriptlets/initialization.py
+++ b/base/server/src/scriptlets/initialization.py
@@ -48,7 +48,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                 # verify that this type of "subsystem" currently EXISTS
                 # for this "instance" (External CA Step 2)
                 deployer.instance.verify_subsystem_exists()
-                deployer.master_dict['pki_skip_installation'] = "True";
+                deployer.master_dict['pki_skip_installation'] = "True"
             else:
                 # verify that this type of "subsystem" does NOT yet
                 # exist for this "instance"
diff --git a/base/server/src/scriptlets/selinux_setup.py b/base/server/src/scriptlets/selinux_setup.py
index 1f3d386166056f810ebc17b2e0b07d8a89b14346..5e3a5ab0d2e44078cd2a72bfca0d0a36f99219b4 100644
--- a/base/server/src/scriptlets/selinux_setup.py
+++ b/base/server/src/scriptlets/selinux_setup.py
@@ -137,19 +137,19 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                             extra=config.PKI_INDENTATION_LEVEL_1)
 
         # check first if any transactions are required
-        if len(ports) == 0 and deployer.master_dict['pki_instance_name'] == \
-           config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_INSTANCE_NAME:
-               return self.rv
+        if (len(ports) == 0 and deployer.master_dict['pki_instance_name'] ==
+            config.PKI_DEPLOYMENT_DEFAULT_TOMCAT_INSTANCE_NAME):
+            return self.rv
         # A maximum of 10 tries to delete the SELinux contexts
         counter = 1
         max_tries = 10
         while True:
             try:
                 # remove SELinux contexts when removing the last subsystem
-                if deployer.master_dict['pki_subsystem'] in config.PKI_APACHE_SUBSYSTEMS and\
-                    deployer.instance.apache_instance_subsystems() == 0 or\
-                    deployer.master_dict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS and\
-                    len(deployer.instance.tomcat_instance_subsystems()) == 0:
+                if (deployer.master_dict['pki_subsystem'] in config.PKI_APACHE_SUBSYSTEMS and
+                    deployer.instance.apache_instance_subsystems() == 0 or
+                    deployer.master_dict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS and
+                    len(deployer.instance.tomcat_instance_subsystems()) == 0):
 
                     trans = seobject.semanageRecords("targeted")
                     trans.start()
@@ -172,7 +172,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                         config.pki_log.info("deleting selinux fcontext \"%s\"",
                                   deployer.master_dict['pki_instance_configuration_path'] + self.suffix,
                                   extra=config.PKI_INDENTATION_LEVEL_2)
-                        fcon.delete(deployer.master_dict['pki_instance_configuration_path'] + \
+                        fcon.delete(deployer.master_dict['pki_instance_configuration_path'] +
                                     self.suffix, "")
 
                         config.pki_log.info("deleting selinux fcontext \"%s\"",
-- 
1.7.10.2

From 85e39092632265d9071041a01ee8ca66a95e98c6 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru redhat com>
Date: Mon, 1 Jul 2013 17:44:46 -0400
Subject: [PATCH 89/89] Fixes for issues reported by pylint.

Fixes for issues in other files.
Ticket #316
---
 base/common/python/pki/upgrade.py          |   35 ++++++++--------
 base/server/python/pki/server/upgrade.py   |   20 ++++-----
 base/server/src/engine/pkihelper.py        |   62 +++++++++++++++-------------
 base/server/src/engine/pkimanifest.py      |   21 +++++-----
 base/server/src/pkispawn                   |   24 +++++------
 base/server/src/scriptlets/finalization.py |    5 ++-
 6 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/base/common/python/pki/upgrade.py b/base/common/python/pki/upgrade.py
index e9e40b15cdfd8c3b8e9222b6f92e9ad58cdb06a4..2d74d1c2f36fde21f3f4c8f3a9f0a36d3b6f3b0b 100644
--- a/base/common/python/pki/upgrade.py
+++ b/base/common/python/pki/upgrade.py
@@ -45,7 +45,7 @@ class Version(object):
         if isinstance(obj, str):
 
             # parse <version>-<release>
-            pos = parts = obj.find('-')
+            pos = obj.find('-')
 
             if pos > 0:
                 self.version = obj[0:pos]
@@ -77,31 +77,28 @@ class Version(object):
     # release is ignored in comparisons
 
     def __eq__(self, other):
-        return self.major == other.major and \
-            self.minor == other.minor and \
-            self.patch == other.patch
-
+        return (self.major == other.major and
+            self.minor == other.minor and
+            self.patch == other.patch)
 
     def __lt__(self, other):
         if self.major < other.major:
             return True
 
-        if self.major == other.major and \
-            self.minor < other.minor:
+        if (self.major == other.major and
+            self.minor < other.minor):
             return True
 
-        if self.major == other.major and \
-            self.minor == other.minor and \
-            self.patch < other.patch:
+        if (self.major == other.major and
+            self.minor == other.minor and
+            self.patch < other.patch):
             return True
 
         return False
 
-
     def __repr__(self):
         return self.version
 
-
 class PKIUpgradeTracker(object):
 
     def __init__(self, name, filename,
@@ -121,14 +118,16 @@ class PKIUpgradeTracker(object):
 
     def remove(self):
 
-        if verbose: print 'Removing ' + self.name + ' tracker.'
+        if verbose: 
+            print 'Removing ' + self.name + ' tracker.'
 
         self.remove_version()
         self.remove_index()
 
     def set(self, version):
 
-        if verbose: print 'Setting ' + self.name + ' tracker to version ' + str(version) + '.'
+        if verbose: 
+            print 'Setting ' + self.name + ' tracker to version ' + str(version) + '.'
 
         self.set_version(version)
         self.remove_index()
@@ -325,7 +324,7 @@ class PKIUpgradeScriptlet(object):
         if os.path.exists(oldfiles):
 
             # restore all backed up files
-            for root, dirnames, filenames in os.walk(oldfiles):
+            for root, _, filenames in os.walk(oldfiles):  #unused item _ for dirnames
                 path = root[len(oldfiles):]
                 for filename in filenames:
                     source = root + '/' + filename
@@ -466,11 +465,11 @@ class PKIUpgrader(object):
                 continue
 
             # load scriptlet class
-            vars = {}
-            execfile(os.path.join(version_dir, filename), vars)
+            variables = {}
+            execfile(os.path.join(version_dir, filename), variables)
 
             # create scriptlet object
-            scriptlet = vars[classname]()
+            scriptlet = variables[classname]()
 
             scriptlet.upgrader = self
             scriptlet.version = version
diff --git a/base/server/python/pki/server/upgrade.py b/base/server/python/pki/server/upgrade.py
index 5de961df398f28d05e3f05d82c715afb6f6c2d02..b89cef607ef6bd0ca4bf64fbec18a78c8edc59e9 100644
--- a/base/server/python/pki/server/upgrade.py
+++ b/base/server/python/pki/server/upgrade.py
@@ -166,14 +166,14 @@ class PKIServerUpgrader(pki.upgrade.PKIUpgrader):
         if self.instanceName and self.instanceType:
             return [pki.server.PKIInstance(self.instanceName, self.instanceType)]
 
-        list = []
+        instance_list = []
 
         if not self.instanceType or self.instanceType >= 10:
             if os.path.exists(os.path.join(pki.server.REGISTRY_DIR, 'tomcat')):
                 for instanceName in os.listdir(pki.server.INSTANCE_BASE_DIR):
                     if not self.instanceName or \
                         self.instanceName == instanceName:
-                        list.append(pki.server.PKIInstance(instanceName))
+                        instance_list.append(pki.server.PKIInstance(instanceName))
 
         if not self.instanceType or self.instanceType == 9:
             for s in pki.server.SUBSYSTEM_TYPES:
@@ -182,11 +182,11 @@ class PKIServerUpgrader(pki.upgrade.PKIUpgrader):
                         os.listdir(os.path.join(pki.server.REGISTRY_DIR, s)):
                         if not self.instanceName or \
                             self.instanceName == instanceName:
-                            list.append(pki.server.PKIInstance(instanceName, 9))
+                            instance_list.append(pki.server.PKIInstance(instanceName, 9))
 
-        list.sort()
+        instance_list.sort()
 
-        return list
+        return instance_list
 
 
     def subsystems(self, instance):
@@ -194,14 +194,14 @@ class PKIServerUpgrader(pki.upgrade.PKIUpgrader):
         if self.subsystemName:
             return [pki.server.PKISubsystem(instance, self.subsystemName)]
 
-        list = []
+        subsystem_list = []
 
         if instance.type >= 10:
             registry_dir = os.path.join(pki.server.REGISTRY_DIR, 'tomcat',
                 instance.name)
             for subsystemName in os.listdir(registry_dir):
                 if subsystemName in pki.server.SUBSYSTEM_TYPES:
-                    list.append(pki.server.PKISubsystem(instance, subsystemName))
+                    subsystem_list.append(pki.server.PKISubsystem(instance, subsystemName))
         else:
             for subsystemName in pki.server.SUBSYSTEM_TYPES:
                 registry_dir = os.path.join(
@@ -209,11 +209,11 @@ class PKIServerUpgrader(pki.upgrade.PKIUpgrader):
                     subsystemName,
                     instance.name)
                 if os.path.exists(registry_dir):
-                    list.append(pki.server.PKISubsystem(instance, subsystemName))
+                    subsystem_list.append(pki.server.PKISubsystem(instance, subsystemName))
 
-        list.sort()
+        subsystem_list.sort()
 
-        return list
+        return subsystem_list
 
     def get_tracker(self, instance, subsystem=None):
 
diff --git a/base/server/src/engine/pkihelper.py b/base/server/src/engine/pkihelper.py
index 18b7f08fb8872d4b31d3195832aad35f9ec74497..563c925d50596833e904de393fcecd981971550c 100644
--- a/base/server/src/engine/pkihelper.py
+++ b/base/server/src/engine/pkihelper.py
@@ -1079,6 +1079,7 @@ class Directory:
     def __init__(self, deployer):
         self.master_dict = deployer.master_dict
         self.identity = deployer.identity
+        self.manifest_db = deployer.manifest_db
 
     def create(self, name, uid=None, gid=None,
                perms=config.PKI_DEPLOYMENT_DEFAULT_DIR_PERMISSIONS,
@@ -1103,7 +1104,7 @@ class Directory:
                                      extra=config.PKI_INDENTATION_LEVEL_3)
                 os.chown(name, uid, gid)
                 # Store record in installation manifest
-                record = manifest.record()
+                record = manifest.Record()
                 record.name = name
                 record.type = manifest.RECORD_TYPE_DIRECTORY
                 record.user = self.master_dict['pki_user']
@@ -1112,7 +1113,7 @@ class Directory:
                 record.gid = gid
                 record.permissions = perms
                 record.acls = acls
-                manifest.database.append(record)
+                self.manifest_db.append(record)
             elif not os.path.isdir(name):
                 config.pki_log.error(
                     log.PKI_DIRECTORY_ALREADY_EXISTS_NOT_A_DIRECTORY_1, name,
@@ -1161,7 +1162,7 @@ class Directory:
                 os.chown(name, uid, gid)
                 # Store record in installation manifest
                 if not silent:
-                    record = manifest.record()
+                    record = manifest.Record()
                     record.name = name
                     record.type = manifest.RECORD_TYPE_DIRECTORY
                     record.user = self.master_dict['pki_user']
@@ -1170,7 +1171,7 @@ class Directory:
                     record.gid = gid
                     record.permissions = perms
                     record.acls = acls
-                    manifest.database.append(record)
+                    self.manifest_db.append(record)
             else:
                 config.pki_log.error(
                     log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, name,
@@ -1276,7 +1277,7 @@ class Directory:
                                     extra=config.PKI_INDENTATION_LEVEL_3)
                                 os.chown(temp_file, uid, gid)
                                 # Store record in installation manifest
-                                record = manifest.record()
+                                record = manifest.Record()
                                 record.name = name
                                 record.type = manifest.RECORD_TYPE_FILE
                                 record.user = self.master_dict['pki_user']
@@ -1285,7 +1286,7 @@ class Directory:
                                 record.gid = gid
                                 record.permissions = file_perms
                                 record.acls = file_acls
-                                manifest.database.append(record)
+                                self.manifest_db.append(record)
                             else:
                                 symlink = entity
                                 config.pki_log.debug(
@@ -1302,7 +1303,7 @@ class Directory:
                                     extra=config.PKI_INDENTATION_LEVEL_3)
                                 os.lchown(symlink, uid, gid)
                                 # Store record in installation manifest
-                                record = manifest.record()
+                                record = manifest.Record()
                                 record.name = name
                                 record.type = manifest.RECORD_TYPE_SYMLINK
                                 record.user = self.master_dict['pki_user']
@@ -1311,7 +1312,7 @@ class Directory:
                                 record.gid = gid
                                 record.permissions = symlink_perms
                                 record.acls = symlink_acls
-                                manifest.database.append(record)
+                                self.manifest_db.append(record)
                         for name in dirs:
                             temp_dir = os.path.join(root, name)
                             config.pki_log.debug(
@@ -1328,7 +1329,7 @@ class Directory:
                                 extra=config.PKI_INDENTATION_LEVEL_3)
                             os.chown(temp_dir, uid, gid)
                             # Store record in installation manifest
-                            record = manifest.record()
+                            record = manifest.Record()
                             record.name = name
                             record.type = manifest.RECORD_TYPE_DIRECTORY
                             record.user = self.master_dict['pki_user']
@@ -1337,7 +1338,7 @@ class Directory:
                             record.gid = gid
                             record.permissions = dir_perms
                             record.acls = dir_acls
-                            manifest.database.append(record)
+                            self.manifest_db.append(record)
                 else:
                     config.pki_log.debug(
                         log.PKIHELPER_IS_A_DIRECTORY_1, name,
@@ -1354,7 +1355,7 @@ class Directory:
                                          extra=config.PKI_INDENTATION_LEVEL_3)
                     os.chown(name, uid, gid)
                     # Store record in installation manifest
-                    record = manifest.record()
+                    record = manifest.Record()
                     record.name = name
                     record.type = manifest.RECORD_TYPE_DIRECTORY
                     record.user = self.master_dict['pki_user']
@@ -1363,7 +1364,7 @@ class Directory:
                     record.gid = gid
                     record.permissions = dir_perms
                     record.acls = dir_acls
-                    manifest.database.append(record)
+                    self.manifest_db.append(record)
         except OSError as exc:
             config.pki_log.error(log.PKI_OSERROR_1, exc,
                                  extra=config.PKI_INDENTATION_LEVEL_2)
@@ -1437,6 +1438,7 @@ class File:
         self.master_dict = deployer.master_dict
         self.slots = deployer.slots
         self.identity = deployer.identity
+        self.manifest_db = deployer.manifest_db
 
     def create(self, name, uid=None, gid=None,
                perms=config.PKI_DEPLOYMENT_DEFAULT_FILE_PERMISSIONS,
@@ -1461,7 +1463,7 @@ class File:
                                      extra=config.PKI_INDENTATION_LEVEL_3)
                 os.chown(name, uid, gid)
                 # Store record in installation manifest
-                record = manifest.record()
+                record = manifest.Record()
                 record.name = name
                 record.type = manifest.RECORD_TYPE_FILE
                 record.user = self.master_dict['pki_user']
@@ -1470,7 +1472,7 @@ class File:
                 record.gid = gid
                 record.permissions = perms
                 record.acls = acls
-                manifest.database.append(record)
+                self.manifest_db.append(record)
             elif not os.path.isfile(name):
                 config.pki_log.error(
                     log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, name,
@@ -1519,7 +1521,7 @@ class File:
                 os.chown(name, uid, gid)
                 # Store record in installation manifest
                 if not silent:
-                    record = manifest.record()
+                    record = manifest.Record()
                     record.name = name
                     record.type = manifest.RECORD_TYPE_FILE
                     record.user = self.master_dict['pki_user']
@@ -1528,7 +1530,7 @@ class File:
                     record.gid = gid
                     record.permissions = perms
                     record.acls = acls
-                    manifest.database.append(record)
+                    self.manifest_db.append(record)
             else:
                 config.pki_log.error(
                     log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, name,
@@ -1608,7 +1610,7 @@ class File:
                                      extra=config.PKI_INDENTATION_LEVEL_3)
                 os.chown(new_name, uid, gid)
                 # Store record in installation manifest
-                record = manifest.record()
+                record = manifest.Record()
                 record.name = new_name
                 record.type = manifest.RECORD_TYPE_FILE
                 record.user = self.master_dict['pki_user']
@@ -1617,7 +1619,7 @@ class File:
                 record.gid = gid
                 record.permissions = perms
                 record.acls = acls
-                manifest.database.append(record)
+                self.manifest_db.append(record)
         except OSError as exc:
             config.pki_log.error(log.PKI_OSERROR_1, exc,
                                  extra=config.PKI_INDENTATION_LEVEL_2)
@@ -1668,7 +1670,7 @@ class File:
                                  extra=config.PKI_INDENTATION_LEVEL_3)
             os.chown(name, uid, gid)
             # Store record in installation manifest
-            record = manifest.record()
+            record = manifest.Record()
             record.name = name
             record.type = manifest.RECORD_TYPE_FILE
             record.user = self.master_dict['pki_user']
@@ -1677,7 +1679,7 @@ class File:
             record.gid = gid
             record.permissions = perms
             record.acls = acls
-            manifest.database.append(record)
+            self.manifest_db.append(record)
         except OSError as exc:
             config.pki_log.error(log.PKI_OSERROR_1, exc,
                                  extra=config.PKI_INDENTATION_LEVEL_2)
@@ -1737,7 +1739,7 @@ class File:
                                      extra=config.PKI_INDENTATION_LEVEL_3)
                 os.chown(new_name, uid, gid)
                 # Store record in installation manifest
-                record = manifest.record()
+                record = manifest.Record()
                 record.name = new_name
                 record.type = manifest.RECORD_TYPE_FILE
                 record.user = self.master_dict['pki_user']
@@ -1746,7 +1748,7 @@ class File:
                 record.gid = gid
                 record.permissions = perms
                 record.acls = acls
-                manifest.database.append(record)
+                self.manifest_db.append(record)
         except OSError as exc:
             config.pki_log.error(log.PKI_OSERROR_1, exc,
                                  extra=config.PKI_INDENTATION_LEVEL_2)
@@ -1787,7 +1789,7 @@ class File:
                                      extra=config.PKI_INDENTATION_LEVEL_3)
                 os.chown(name, uid, gid)
                 # Store record in installation manifest
-                record = manifest.record()
+                record = manifest.Record()
                 record.name = name
                 record.type = manifest.RECORD_TYPE_FILE
                 record.user = self.master_dict['pki_user']
@@ -1796,7 +1798,7 @@ class File:
                 record.gid = gid
                 record.permissions = perms
                 record.acls = acls
-                manifest.database.append(record)
+                self.manifest_db.append(record)
             elif not os.path.isfile(name):
                 config.pki_log.error(
                     log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, name,
@@ -1819,6 +1821,7 @@ class Symlink:
     def __init__(self, deployer):
         self.master_dict = deployer.master_dict
         self.identity = deployer.identity
+        self.manifest_db = deployer.manifest_db
 
     def create(self, name, link, uid=None, gid=None,
                acls=None, allow_dangling_symlink=False, critical_failure=True):
@@ -1847,7 +1850,7 @@ class Symlink:
                                      extra=config.PKI_INDENTATION_LEVEL_3)
                 os.lchown(link, uid, gid)
                 # Store record in installation manifest
-                record = manifest.record()
+                record = manifest.Record()
                 record.name = link
                 record.type = manifest.RECORD_TYPE_SYMLINK
                 record.user = self.master_dict['pki_user']
@@ -1857,7 +1860,7 @@ class Symlink:
                 record.permissions = \
                     config.PKI_DEPLOYMENT_DEFAULT_SYMLINK_PERMISSIONS
                 record.acls = acls
-                manifest.database.append(record)
+                self.manifest_db.append(record)
             elif not os.path.islink(link):
                 config.pki_log.error(
                     log.PKI_SYMLINK_ALREADY_EXISTS_NOT_A_SYMLINK_1, link,
@@ -1903,7 +1906,7 @@ class Symlink:
                 os.lchown(link, uid, gid)
                 # Store record in installation manifest
                 if not silent:
-                    record = manifest.record()
+                    record = manifest.Record()
                     record.name = link
                     record.type = manifest.RECORD_TYPE_SYMLINK
                     record.user = self.master_dict['pki_user']
@@ -1913,7 +1916,7 @@ class Symlink:
                     record.permissions = \
                         config.PKI_DEPLOYMENT_DEFAULT_SYMLINK_PERMISSIONS
                     record.acls = acls
-                    manifest.database.append(record)
+                    self.manifest_db.append(record)
             else:
                 config.pki_log.error(
                     log.PKI_SYMLINK_MISSING_OR_NOT_A_SYMLINK_1, link,
@@ -3497,7 +3500,8 @@ class PKIDeployer:
         # Global dictionary variables
         self.master_dict = pki_master_dict
         self.slots = pki_slots_dict
-
+        self.manifest_db = []
+        
         # Utility objects
         self.identity = Identity(self)
         self.namespace = Namespace(self)
diff --git a/base/server/src/engine/pkimanifest.py b/base/server/src/engine/pkimanifest.py
index aaabbf5fd3324555b38c1beb97657b33584f88ce..b48bfb8c426d760e95ea73cd4d04bb25d3525305 100644
--- a/base/server/src/engine/pkimanifest.py
+++ b/base/server/src/engine/pkimanifest.py
@@ -20,10 +20,7 @@
 #
 
 # System Imports
-from collections import namedtuple
 import csv
-import sys
-
 
 # PKI Deployment Imports
 import pkiconfig as config
@@ -37,7 +34,7 @@ RECORD_TYPE_SYMLINK = "symlink"
 
 
 # PKI Deployment Manifest Record Class
-class record(object):
+class Record(object):
     __slots__ = "name", \
                "type", \
                "user", \
@@ -46,6 +43,9 @@ class record(object):
                "gid", \
                "permissions", \
                "acls",
+               
+    def __init__(self):
+        pass
 
     def items(self):
         "dict style items"
@@ -64,9 +64,11 @@ class record(object):
 
 
 # PKI Deployment Manifest File Class
-class file:
-    global database
-    filename = None
+class File:
+    
+    def __init__(self, database):
+        self.filename = None
+        self.database = database
 
     def register(self, name):
         self.filename = name
@@ -75,7 +77,7 @@ class file:
         try:
             with open(self.filename, "wt") as fd:
                 c = csv.writer(fd)
-                for record in database:
+                for record in self.database:
                     c.writerow(tuple(record))
         except IOError as exc:
             config.pki_log.error(log.PKI_IOERROR_1, exc,
@@ -93,6 +95,3 @@ class file:
                                  extra=config.PKI_INDENTATION_LEVEL_1)
             raise
 
-# PKI Deployment Global Named Tuples
-database = []
-file = file()
diff --git a/base/server/src/pkispawn b/base/server/src/pkispawn
index 75a04b4a6e498ade6910b9487403ec1fbd95811a..a47f8f199c9ea759ff72cccfdb63f44580cf5bd1 100755
--- a/base/server/src/pkispawn
+++ b/base/server/src/pkispawn
@@ -28,16 +28,13 @@ if not hasattr(sys, "hexversion") or sys.hexversion < 0x020700f0:
     print "Please upgrade to at least Python 2.7.0."
     sys.exit(1)
 try:
-    import argparse
     import ldap
-    import logging
     import os
     import requests
     import socket
     import struct
     import subprocess
     import time
-    import urllib2
     import traceback
     from time import strftime as date
     from pki.deployment import pkiconfig as config
@@ -373,7 +370,7 @@ def main(argv):
         instance = scriptlet.PkiScriptlet()
         try:
             rv = instance.spawn(deployer)
-        except:
+        except Exception:
             log_error_details()
             print
             print "Installation failed."
@@ -412,15 +409,16 @@ def print_install_information(pki_master_dict):
     print log.PKI_SPAWN_INFORMATION_FOOTER
 
 def log_error_details():
-        type, value, stacktrace = sys.exc_info()
-        config.pki_log.debug("Error Type: " + type.__name__, extra=config.PKI_INDENTATION_LEVEL_2)
-        config.pki_log.debug("Error Message: " + str(value), extra=config.PKI_INDENTATION_LEVEL_2)
-        stacktrace_list = traceback.format_list(traceback.extract_tb(stacktrace))
-        stacktrace = ""
-        for l in stacktrace_list:
-            stacktrace += l
-        config.pki_log.debug(stacktrace, extra=config.PKI_INDENTATION_LEVEL_2)
-        sys.exc_clear()
+    
+    type, value, stacktrace = sys.exc_info()
+    config.pki_log.debug("Error Type: " + type.__name__, extra=config.PKI_INDENTATION_LEVEL_2)
+    config.pki_log.debug("Error Message: " + str(value), extra=config.PKI_INDENTATION_LEVEL_2)
+    stacktrace_list = traceback.format_list(traceback.extract_tb(stacktrace))
+    stacktrace = ""
+    for l in stacktrace_list:
+        stacktrace += l
+    config.pki_log.debug(stacktrace, extra=config.PKI_INDENTATION_LEVEL_2)
+    sys.exc_clear()
 
 # PKI Deployment Entry Point
 if __name__ == "__main__":
diff --git a/base/server/src/scriptlets/finalization.py b/base/server/src/scriptlets/finalization.py
index 45b4a3ceb888a4a01822dc3f4c50234ae985cb41..529f9d45d6f698a7469b6c7a344e1bd0a630c54c 100644
--- a/base/server/src/scriptlets/finalization.py
+++ b/base/server/src/scriptlets/finalization.py
@@ -53,8 +53,9 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                             extra=config.PKI_INDENTATION_LEVEL_2)
         # for record in manifest.database:
         #     print tuple(record)
-        manifest.file.register(deployer.master_dict['pki_manifest'])
-        manifest.file.write()
+        manifest_file = manifest.File(deployer.manifest_db)
+        manifest_file.register(deployer.master_dict['pki_manifest'])
+        manifest_file.write()
         deployer.file.modify(deployer.master_dict['pki_manifest'], silent=True)
 
         # Also, for debugging/auditing purposes, save a timestamped copy of
-- 
1.7.10.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]