>From 0762566785b11c7a9879809ae82b8925fb829c57 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Wed, 30 Mar 2016 04:29:11 +0200
Subject: [PATCH] Install tools clean-up.

Some variables in pkispawn and pkidestroy have been renamed for
clarity.

The unused PKI_CERT_DB_PASSWORD_SLOT variable has been removed.

The constant pki_self_signed_token property has been moved into
default.cfg.

https://fedorahosted.org/pki/ticket/2247
---
 base/server/config/pkislots.cfg                       |  1 -
 base/server/etc/default.cfg                           |  1 +
 base/server/python/pki/server/deployment/pkiparser.py |  3 ---
 base/server/sbin/pkidestroy                           | 12 ++++++------
 base/server/sbin/pkispawn                             | 12 ++++++------
 5 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/base/server/config/pkislots.cfg b/base/server/config/pkislots.cfg
index 23c1f824a4ec27d50161549c21a55d36d662fec7..926527599cee5f0de80746bb56e075e0a3e90def 100644
--- a/base/server/config/pkislots.cfg
+++ b/base/server/config/pkislots.cfg
@@ -11,7 +11,6 @@ PKI_AJP_PORT_SLOT=[PKI_AJP_PORT]
 PKI_AJP_REDIRECT_PORT_SLOT=[PKI_AJP_REDIRECT_PORT]
 PKI_CA_HOSTNAME_SLOT=[PKI_CA_HOSTNAME]
 PKI_CA_PORT_SLOT=[PKI_CA_PORT]
-PKI_CERT_DB_PASSWORD_SLOT=[PKI_CERT_DB_PASSWORD]
 PKI_CFG_PATH_NAME_SLOT=[PKI_CFG_PATH_NAME]
 PKI_CLOSE_AJP_PORT_COMMENT_SLOT=[PKI_CLOSE_AJP_PORT_COMMENT]
 PKI_CLOSE_ENABLE_PROXY_COMMENT_SLOT=[PKI_CLOSE_ENABLE_PROXY_COMMENT]
diff --git a/base/server/etc/default.cfg b/base/server/etc/default.cfg
index ae0021bb19c9aeda03a7eb5a42490d4919315a82..21c792472c7757ce5eda5e96ccfbd0552cec8b98 100644
--- a/base/server/etc/default.cfg
+++ b/base/server/etc/default.cfg
@@ -109,6 +109,7 @@ pki_security_domain_https_port=8443
 pki_security_domain_name=%(pki_dns_domainname)s Security Domain
 pki_security_domain_password=
 pki_security_domain_user=caadmin
+pki_self_signed_token=internal
 #for supporting server cert SAN injection
 pki_san_inject=False
 pki_san_for_server_cert=
diff --git a/base/server/python/pki/server/deployment/pkiparser.py b/base/server/python/pki/server/deployment/pkiparser.py
index ca9ef998f69952dc1495c9b17dd1cf45d71f16f4..273b5ac3071640dd836adf1b541cc56b494a24c6 100644
--- a/base/server/python/pki/server/deployment/pkiparser.py
+++ b/base/server/python/pki/server/deployment/pkiparser.py
@@ -794,8 +794,6 @@ class PKIConfigParser:
                 self.mdict['pki_ca_hostname']
             self.mdict['PKI_CA_PORT_SLOT'] = \
                 self.mdict['pki_ca_port']
-            self.mdict['PKI_CERT_DB_PASSWORD_SLOT'] = \
-                self.mdict['pki_pin']
             self.mdict['PKI_CFG_PATH_NAME_SLOT'] = \
                 self.mdict['pki_target_cs_cfg']
             self.mdict['PKI_CLOSE_SEPARATE_PORTS_SERVER_COMMENT_SLOT'] = \
@@ -1106,7 +1104,6 @@ class PKIConfigParser:
             self.mdict['pki_secmod_database'] = \
                 os.path.join(self.mdict['pki_database_path'],
                              "secmod.db")
-            self.mdict['pki_self_signed_token'] = "internal"
             self.mdict['pki_self_signed_nickname'] = \
                 self.mdict['pki_ssl_server_nickname']
             self.mdict['pki_self_signed_subject'] = \
diff --git a/base/server/sbin/pkidestroy b/base/server/sbin/pkidestroy
index 12d37f2f39b56958e95eea98d92128d8f206301c..d7285c7e50e1f3f4e50fd30077eb385fd831f415 100755
--- a/base/server/sbin/pkidestroy
+++ b/base/server/sbin/pkidestroy
@@ -257,12 +257,12 @@ def main(argv):
     pki_subsystem_scriptlets = parser.mdict['destroy_scriplets'].split()
     deployer = util.PKIDeployer(parser.mdict)
     rv = 0
-    for pki_scriptlet in pki_subsystem_scriptlets:
-        scriptlet = __import__("pki.server.deployment.scriptlets." +
-                               pki_scriptlet,
-                               fromlist=[pki_scriptlet])
-        instance = scriptlet.PkiScriptlet()
-        rv = instance.destroy(deployer)
+    for scriptlet_name in pki_subsystem_scriptlets:
+        scriptlet_module = __import__(
+            "pki.server.deployment.scriptlets." + scriptlet_name,
+            fromlist=[scriptlet_name])
+        scriptlet = scriptlet_module.PkiScriptlet()
+        rv = scriptlet.destroy(deployer)
         if rv != 0:
             sys.exit(1)
     config.pki_log.debug(log.PKI_DICTIONARY_MASTER,
diff --git a/base/server/sbin/pkispawn b/base/server/sbin/pkispawn
index e7b22ef1e66598c2a1a64b544ffdc171b88bbd4a..caa5e9bee474cbb8aa76701f83cc53dab308fc44 100755
--- a/base/server/sbin/pkispawn
+++ b/base/server/sbin/pkispawn
@@ -515,13 +515,13 @@ def main(argv):
     pki_subsystem_scriptlets = parser.mdict['spawn_scriplets'].split()
     deployer = util.PKIDeployer(parser.mdict, parser.slots_dict)
     rv = 0
-    for pki_scriptlet in pki_subsystem_scriptlets:
-        scriptlet = __import__("pki.server.deployment.scriptlets." +
-                               pki_scriptlet,
-                               fromlist=[pki_scriptlet])
-        instance = scriptlet.PkiScriptlet()
+    for scriptlet_name in pki_subsystem_scriptlets:
+        scriptlet_module = __import__(
+            "pki.server.deployment.scriptlets." + scriptlet_name,
+            fromlist=[scriptlet_name])
+        scriptlet = scriptlet_module.PkiScriptlet()
         try:
-            rv = instance.spawn(deployer)
+            rv = scriptlet.spawn(deployer)
         # pylint: disable=W0703
         except Exception:
             log_error_details()
-- 
2.7.3

