summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2016-12-21 04:35:21 +0100
committerEndi S. Dewata <edewata@redhat.com>2016-12-21 07:56:11 +0100
commit52cf2bb8c4cc2d60bef779e9874c696296afa30a (patch)
tree1561a210780266183e95f84f39085425e523f471 /base
parent9822676b7f00cc7e78d42c50c2506a289ed9c1c6 (diff)
Refactored master & slots dictionaries creation.
To improve reusability the deployment tools have been modified such that the master and slots dictionary objects are created in PKIDeployer at the beginning of the program. The PKIConfigParser has been modified to use the same dictionary objects.
Diffstat (limited to 'base')
-rw-r--r--base/server/python/pki/server/deployment/pkihelper.py27
-rw-r--r--base/server/python/pki/server/deployment/pkiparser.py9
-rwxr-xr-xbase/server/sbin/pkidestroy7
-rwxr-xr-xbase/server/sbin/pkispawn7
4 files changed, 39 insertions, 11 deletions
diff --git a/base/server/python/pki/server/deployment/pkihelper.py b/base/server/python/pki/server/deployment/pkihelper.py
index 1a09f4964..58188657d 100644
--- a/base/server/python/pki/server/deployment/pkihelper.py
+++ b/base/server/python/pki/server/deployment/pkihelper.py
@@ -4584,12 +4584,33 @@ class SystemCertificateVerifier:
class PKIDeployer:
"""Holds the global dictionaries and the utility objects"""
- def __init__(self, pki_mdict, slots_dict=None):
+ def __init__(self):
# Global dictionary variables
- self.mdict = pki_mdict
- self.slots = slots_dict
+ self.mdict = {}
+ self.slots = {}
self.manifest_db = []
+ self.identity = None
+ self.namespace = None
+ self.configuration_file = None
+ self.instance = None
+ self.directory = None
+ self.file = None
+ self.symlink = None
+ self.war = None
+ self.password = None
+ self.hsm = None
+ self.certutil = None
+ self.modutil = None
+ self.pk12util = None
+ self.kra_connector = None
+ self.security_domain = None
+ self.servercertnick_conf = None
+ self.systemd = None
+ self.tps_connector = None
+ self.config_client = None
+
+ def init(self):
# Utility objects
self.identity = Identity(self)
self.namespace = Namespace(self)
diff --git a/base/server/python/pki/server/deployment/pkiparser.py b/base/server/python/pki/server/deployment/pkiparser.py
index 6e922cf6c..027703bbc 100644
--- a/base/server/python/pki/server/deployment/pkiparser.py
+++ b/base/server/python/pki/server/deployment/pkiparser.py
@@ -54,7 +54,8 @@ class PKIConfigParser:
COMMENT_CHAR = '#'
OPTION_CHAR = '='
- def __init__(self, description, epilog):
+ def __init__(self, description, epilog, deployer=None):
+ self.deployer = deployer
self.pki_config = None
# Read and process command-line options
@@ -101,8 +102,8 @@ class PKIConfigParser:
self.authdb_connection = None
# Master and Slot dictionaries
- self.mdict = dict()
- self.slots_dict = dict()
+ self.mdict = deployer.mdict
+ self.slots_dict = deployer.slots
# PKI Deployment Helper Functions
def process_command_line_arguments(self):
@@ -1385,7 +1386,7 @@ class PKIConfigParser:
parser.optionxform = str
parser.read(config.PKI_DEPLOYMENT_SLOTS_CONFIGURATION_FILE)
# Slots configuration file name/value pairs
- self.slots_dict = dict(parser.items('Tomcat'))
+ self.slots_dict.update(dict(parser.items('Tomcat')))
except configparser.ParsingError as err:
rv = err
return rv
diff --git a/base/server/sbin/pkidestroy b/base/server/sbin/pkidestroy
index 923b55076..0c62c671c 100755
--- a/base/server/sbin/pkidestroy
+++ b/base/server/sbin/pkidestroy
@@ -64,6 +64,8 @@ def interrupt_handler(event, frame):
def main(argv):
"""main entry point"""
+ deployer = util.PKIDeployer()
+
config.pki_deployment_executable = os.path.basename(argv[0])
# Set the umask
@@ -100,7 +102,8 @@ def main(argv):
# Read and process command-line arguments.
parser = PKIConfigParser(
'PKI Instance Removal',
- log.PKIDESTROY_EPILOG)
+ log.PKIDESTROY_EPILOG,
+ deployer=deployer)
parser.optional.add_argument(
'-i',
@@ -256,7 +259,7 @@ def main(argv):
# Process the various "scriptlets" to remove the specified PKI subsystem.
pki_subsystem_scriptlets = parser.mdict['destroy_scriplets'].split()
- deployer = util.PKIDeployer(parser.mdict)
+ deployer.init()
try:
for scriptlet_name in pki_subsystem_scriptlets:
diff --git a/base/server/sbin/pkispawn b/base/server/sbin/pkispawn
index c87c49a3d..9cddcb291 100755
--- a/base/server/sbin/pkispawn
+++ b/base/server/sbin/pkispawn
@@ -67,6 +67,8 @@ def interrupt_handler(event, frame):
def main(argv):
"""main entry point"""
+ deployer = util.PKIDeployer()
+
config.pki_deployment_executable = os.path.basename(argv[0])
# Set the umask
@@ -102,7 +104,8 @@ def main(argv):
# Read and process command-line arguments.
parser = PKIConfigParser(
'PKI Instance Installation and Configuration',
- log.PKISPAWN_EPILOG)
+ log.PKISPAWN_EPILOG,
+ deployer=deployer)
parser.optional.add_argument(
'-f',
@@ -514,7 +517,7 @@ def main(argv):
# Process the various "scriptlets" to create the specified PKI subsystem.
pki_subsystem_scriptlets = parser.mdict['spawn_scriplets'].split()
- deployer = util.PKIDeployer(parser.mdict, parser.slots_dict)
+ deployer.init()
try:
for scriptlet_name in pki_subsystem_scriptlets: