summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/common/python/pki/encoder.py1
-rwxr-xr-xbase/common/sbin/pki-upgrade1
-rw-r--r--base/server/python/pki/server/__init__.py8
-rwxr-xr-xbase/server/sbin/pki-server-upgrade2
-rw-r--r--base/server/src/engine/pkiconfig.py3
-rw-r--r--base/server/src/engine/pkilogging.py14
-rw-r--r--base/server/src/engine/pkiparser.py21
-rwxr-xr-xbase/server/src/pkidestroy10
-rwxr-xr-xbase/server/src/pkispawn22
9 files changed, 38 insertions, 44 deletions
diff --git a/base/common/python/pki/encoder.py b/base/common/python/pki/encoder.py
index c100be3d5..8d8a9c101 100644
--- a/base/common/python/pki/encoder.py
+++ b/base/common/python/pki/encoder.py
@@ -1,5 +1,4 @@
import json
-import pki.system
TYPES = {}
NOTYPES = {}
diff --git a/base/common/sbin/pki-upgrade b/base/common/sbin/pki-upgrade
index c739598d4..48fb48b93 100755
--- a/base/common/sbin/pki-upgrade
+++ b/base/common/sbin/pki-upgrade
@@ -20,7 +20,6 @@
#
import getopt
-import os
import signal
import sys
diff --git a/base/server/python/pki/server/__init__.py b/base/server/python/pki/server/__init__.py
index c60c5a325..fab695bdc 100644
--- a/base/server/python/pki/server/__init__.py
+++ b/base/server/python/pki/server/__init__.py
@@ -59,10 +59,10 @@ class PKISubsystem(object):
class PKIInstance(object):
- def __init__(self, name, type=10):
+ def __init__(self, name, vtype=10):
self.name = name
- self.type = type
- if self.type >= 10:
+ self.vtype = vtype
+ if self.vtype >= 10:
self.conf_dir = os.path.join(INSTANCE_BASE_DIR, name, 'conf')
self.base_dir = os.path.join(INSTANCE_BASE_DIR, name)
else:
@@ -77,7 +77,7 @@ class PKIInstance(object):
'Invalid instance: ' + self.__repr__(), None)
def __repr__(self):
- if self.type == 9:
+ if self.vtype == 9:
return "Dogtag 9 " + self.name
return self.name
diff --git a/base/server/sbin/pki-server-upgrade b/base/server/sbin/pki-server-upgrade
index 0b43f9b4b..59db87ba2 100755
--- a/base/server/sbin/pki-server-upgrade
+++ b/base/server/sbin/pki-server-upgrade
@@ -68,7 +68,7 @@ def main(argv):
signal.signal(signal.SIGINT, interrupt_handler)
try:
- opts, args = getopt.getopt(argv[1:], 'hi:s:t:vX', [
+ opts, _ = getopt.getopt(argv[1:], 'hi:s:t:vX', [
'instance=', 'subsystem=', 'instance-type=',
'scriptlet-version=', 'scriptlet-index=',
'silent', 'status', 'revert',
diff --git a/base/server/src/engine/pkiconfig.py b/base/server/src/engine/pkiconfig.py
index d9be80507..2e9463b9d 100644
--- a/base/server/src/engine/pkiconfig.py
+++ b/base/server/src/engine/pkiconfig.py
@@ -18,7 +18,6 @@
# Copyright (C) 2012 Red Hat, Inc.
# All rights reserved.
#
-import re
# PKI Deployment Constants
PKI_DEPLOYMENT_DEFAULT_CLIENT_DIR_PERMISSIONS = 00755
@@ -99,6 +98,8 @@ pki_install_time = None
pki_timestamp = None
pki_architecture = None
pki_hostname = None
+pki_dns_domainname = None
+pki_certificate_timestamp = None
# PKI Deployment Command-Line Variables
diff --git a/base/server/src/engine/pkilogging.py b/base/server/src/engine/pkilogging.py
index b73650ee5..c91a7656f 100644
--- a/base/server/src/engine/pkilogging.py
+++ b/base/server/src/engine/pkilogging.py
@@ -29,15 +29,15 @@ sensitive_parameters = []
# Initialize 'pretty print' for objects
pp = pprint.PrettyPrinter(indent=4)
-def format(dict):
+def log_format(given_dict):
new_dict = {}
# mask sensitive data
- for key in dict:
+ for key in given_dict:
if key in sensitive_parameters:
value = 'XXXXXXXX'
else:
- value = dict[key]
+ value = given_dict[key]
new_dict[key] = value
return pp.pformat(new_dict)
@@ -64,13 +64,13 @@ def enable_pki_logger(log_dir, log_name, log_level, console_log_level, name):
logger.addHandler(console)
# Configure file handler
- file = logging.FileHandler(log_dir + "/" + log_name, 'w')
- file.setLevel(log_level)
+ log_file = logging.FileHandler(log_dir + "/" + log_name, 'w')
+ log_file.setLevel(log_level)
file_format = logging.Formatter('%(asctime)s %(name)-12s: ' + \
'%(levelname)-8s ' + \
'%(indent)s%(message)s',
'%Y-%m-%d %H:%M:%S')
- file.setFormatter(file_format)
- logger.addHandler(file)
+ log_file.setFormatter(file_format)
+ logger.addHandler(log_file)
return logger
diff --git a/base/server/src/engine/pkiparser.py b/base/server/src/engine/pkiparser.py
index c740a0647..a70a8df6e 100644
--- a/base/server/src/engine/pkiparser.py
+++ b/base/server/src/engine/pkiparser.py
@@ -30,9 +30,6 @@ import random
import requests
import string
import subprocess
-import sys
-import time
-
# PKI Imports
import pki
@@ -229,26 +226,26 @@ class PKIConfigParser:
return values
- def set_property(self, section, property, value):
+ def set_property(self, section, key, 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)
+ self.pki_config.set(section, key, value)
self.flatten_master_dict()
if section != "DEFAULT" and not config.user_config.has_section(section):
config.user_config.add_section(section)
- config.user_config.set(section, property, value)
+ config.user_config.set(section, key, value)
def print_text(self, message):
print ' ' * self.indent + message
def read_text(self, message,
- section=None, property=None, default=None,
+ section=None, key=None, default=None,
options=None, sign=':', allowEmpty=True, caseSensitive=True):
- if default is None and property is not None:
- default = self.pki_master_dict[property]
+ if default is None and key is not None:
+ default = self.pki_master_dict[key]
if default:
message = message + ' [' + default + ']'
message = ' ' * self.indent + message + sign + ' '
@@ -281,12 +278,12 @@ class PKIConfigParser:
value = value.replace("%", "%%")
if section:
- self.set_property(section, property, value)
+ self.set_property(section, key, value)
return value
- def read_password(self, message, section=None, property=None,
+ def read_password(self, message, section=None, key=None,
verifyMessage=None):
message = ' ' * self.indent + message + ': '
if verifyMessage is not None:
@@ -310,7 +307,7 @@ class PKIConfigParser:
password = password.replace("%", "%%")
if section:
- self.set_property(section, property, password)
+ self.set_property(section, key, password)
return password
diff --git a/base/server/src/pkidestroy b/base/server/src/pkidestroy
index deca8d586..76fee7206 100755
--- a/base/server/src/pkidestroy
+++ b/base/server/src/pkidestroy
@@ -28,8 +28,6 @@ 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 logging
import os
import socket
import struct
@@ -180,7 +178,7 @@ def main(argv):
print "ERROR: " + log.PKI_INSTANCE_DOES_NOT_EXIST_1 %\
deployed_pki_instance_path
print
- parser.arg_parser.exit(-1);
+ parser.arg_parser.exit(-1)
# verify that previously deployed subsystem for this instance exists
deployed_pki_subsystem_path = deployed_pki_instance_path + "/" +\
@@ -189,7 +187,7 @@ def main(argv):
print "ERROR: " + log.PKI_SUBSYSTEM_DOES_NOT_EXIST_2 %\
(config.pki_subsystem, deployed_pki_instance_path)
print
- parser.arg_parser.exit(-1);
+ parser.arg_parser.exit(-1)
config.default_deployment_cfg = config.PKI_DEPLOYMENT_DEFAULT_CONFIGURATION_FILE
@@ -234,7 +232,7 @@ def main(argv):
config.pki_log_name
config.pki_log.debug(log.PKI_DICTIONARY_MASTER,
extra=config.PKI_INDENTATION_LEVEL_0)
- config.pki_log.debug(pkilogging.format(parser.pki_master_dict),
+ config.pki_log.debug(pkilogging.log_format(parser.pki_master_dict),
extra=config.PKI_INDENTATION_LEVEL_0)
print "Uninstalling " + config.pki_subsystem + " from " + deployed_pki_instance_path + "."
@@ -253,7 +251,7 @@ def main(argv):
sys.exit(1)
config.pki_log.debug(log.PKI_DICTIONARY_MASTER,
extra=config.PKI_INDENTATION_LEVEL_0)
- config.pki_log.debug(pkilogging.format(parser.pki_master_dict),
+ config.pki_log.debug(pkilogging.log_format(parser.pki_master_dict),
extra=config.PKI_INDENTATION_LEVEL_0)
print
diff --git a/base/server/src/pkispawn b/base/server/src/pkispawn
index 6339b1096..5b38b6e39 100755
--- a/base/server/src/pkispawn
+++ b/base/server/src/pkispawn
@@ -86,7 +86,6 @@ def main(argv):
config.pki_hostname = socket.getfqdn()
# Retrieve DNS domainname
- config.pki_dns_domainname = None
try:
config.pki_dns_domainname = subprocess.check_output("dnsdomainname",
shell = True)
@@ -310,7 +309,7 @@ def main(argv):
parser.compose_pki_slots_dictionary()
config.pki_log.debug(log.PKI_DICTIONARY_SLOTS,
extra=config.PKI_INDENTATION_LEVEL_0)
- config.pki_log.debug(pkilogging.format(parser.pki_slots_dict),
+ config.pki_log.debug(pkilogging.log_format(parser.pki_slots_dict),
extra=config.PKI_INDENTATION_LEVEL_0)
# Combine the various sectional dictionaries into a PKI master dictionary
@@ -320,7 +319,7 @@ def main(argv):
config.pki_log_name
config.pki_log.debug(log.PKI_DICTIONARY_MASTER,
extra=config.PKI_INDENTATION_LEVEL_0)
- config.pki_log.debug(pkilogging.format(parser.pki_master_dict),
+ config.pki_log.debug(pkilogging.log_format(parser.pki_master_dict),
extra=config.PKI_INDENTATION_LEVEL_0)
if not interactive and\
@@ -370,6 +369,7 @@ def main(argv):
instance = scriptlet.PkiScriptlet()
try:
rv = instance.spawn(deployer)
+ # pylint: disable-msg=W0703
except Exception:
log_error_details()
print
@@ -382,7 +382,7 @@ def main(argv):
sys.exit(1)
config.pki_log.debug(log.PKI_DICTIONARY_MASTER,
extra=config.PKI_INDENTATION_LEVEL_0)
- config.pki_log.debug(pkilogging.format(parser.pki_master_dict),
+ config.pki_log.debug(pkilogging.log_format(parser.pki_master_dict),
extra=config.PKI_INDENTATION_LEVEL_0)
print_install_information(parser.pki_master_dict)
@@ -410,14 +410,14 @@ def print_install_information(pki_master_dict):
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 = ""
+ e_type, e_value, e_stacktrace = sys.exc_info()
+ config.pki_log.debug("Error Type: " + e_type.__name__, extra=config.PKI_INDENTATION_LEVEL_2)
+ config.pki_log.debug("Error Message: " + str(e_value), extra=config.PKI_INDENTATION_LEVEL_2)
+ stacktrace_list = traceback.format_list(traceback.extract_tb(e_stacktrace))
+ e_stacktrace = ""
for l in stacktrace_list:
- stacktrace += l
- config.pki_log.debug(stacktrace, extra=config.PKI_INDENTATION_LEVEL_2)
+ e_stacktrace += l
+ config.pki_log.debug(e_stacktrace, extra=config.PKI_INDENTATION_LEVEL_2)
sys.exc_clear()
# PKI Deployment Entry Point