>From c7ae690180e274472c78710fa2a6d09f9604d9e2 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Wed, 11 May 2016 19:35:07 +0200
Subject: [PATCH] Fixed install-only message in external CA case.

Previously, in external CA case if pkispawn was executed with
pki_skip_configuration=True, it would stop the execution before
the step 1 was fully completed (i.e. generating CSR), but it would
incorrectly show a message indicating the CSR has been generated.

The code that displays the installation summary has been fixed to
check for pki_skip_configuration first before checking for external
CA case to ensure that it displays the appropriate message for each
step.

The code that generates the Tomcat instance systemd service link
was moved into instance_layout.py to avoid redundant executions.

The pkispawn and pkidestroy have also be modified to remove
redundant log of deployment parameters in master dictionary.
---
 .../pki/server/deployment/scriptlets/configuration.py       |  7 -------
 .../pki/server/deployment/scriptlets/instance_layout.py     |  8 ++++++++
 base/server/sbin/pkidestroy                                 |  5 -----
 base/server/sbin/pkispawn                                   | 13 ++++---------
 4 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/base/server/python/pki/server/deployment/scriptlets/configuration.py b/base/server/python/pki/server/deployment/scriptlets/configuration.py
index fc5dc84c4bbcde0c8972705ab64ebdcada20fc4d..373b58ef45cf84fd5aa0be1856cff5ee23b13aba 100644
--- a/base/server/python/pki/server/deployment/scriptlets/configuration.py
+++ b/base/server/python/pki/server/deployment/scriptlets/configuration.py
@@ -40,12 +40,6 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
 
     def spawn(self, deployer):
 
-        # ALWAYS establish the following Tomcat instance symbolic link since
-        # this link is required by both automatic pkispawn instance
-        # configuration as well as manual browser GUI instance configuration
-        deployer.symlink.create(deployer.mdict['pki_systemd_service'],
-                                deployer.mdict['pki_systemd_service_link'])
-
         if config.str2bool(deployer.mdict['pki_skip_configuration']):
             config.pki_log.info(log.SKIP_CONFIGURATION_SPAWN_1, __name__,
                                 extra=config.PKI_INDENTATION_LEVEL_1)
@@ -354,4 +348,3 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
         if len(deployer.instance.tomcat_instance_subsystems()) == 1:
             if deployer.directory.exists(deployer.mdict['pki_client_dir']):
                 deployer.directory.delete(deployer.mdict['pki_client_dir'])
-            deployer.symlink.delete(deployer.mdict['pki_systemd_service_link'])
diff --git a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
index 2af86bfeb246cf10d297af8ca8d8b8391c55f15a..98d82ff98d9cb40e1ee2116250b8271b04be868f 100644
--- a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
+++ b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
@@ -293,12 +293,20 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                         deployer.mdict['pki_symkey_jar'],
                         deployer.mdict['pki_symkey_jar_link'])
 
+            # create Tomcat instance systemd service link
+            deployer.symlink.create(deployer.mdict['pki_systemd_service'],
+                                    deployer.mdict['pki_systemd_service_link'])
+
     def destroy(self, deployer):
 
         config.pki_log.info(log.INSTANCE_DESTROY_1, __name__,
                             extra=config.PKI_INDENTATION_LEVEL_1)
 
         if len(deployer.instance.tomcat_instance_subsystems()) == 0:
+
+            # remove Tomcat instance systemd service link
+            deployer.symlink.delete(deployer.mdict['pki_systemd_service_link'])
+
             # remove Tomcat instance base
             deployer.directory.delete(deployer.mdict['pki_instance_path'])
             # remove Tomcat instance logs
diff --git a/base/server/sbin/pkidestroy b/base/server/sbin/pkidestroy
index 404298ba9413135a7107c3777120b2dc7a1169b9..923b55076b974ffa344f19b2ca8bf8ec4663cfb7 100755
--- a/base/server/sbin/pkidestroy
+++ b/base/server/sbin/pkidestroy
@@ -277,11 +277,6 @@ def main(argv):
         print()
         sys.exit(1)
 
-    config.pki_log.debug(log.PKI_DICTIONARY_MASTER,
-                         extra=config.PKI_INDENTATION_LEVEL_0)
-    config.pki_log.debug(pkilogging.log_format(parser.mdict),
-                         extra=config.PKI_INDENTATION_LEVEL_0)
-
     print()
     print("Uninstallation complete.")
 
diff --git a/base/server/sbin/pkispawn b/base/server/sbin/pkispawn
index f75fa43aec5f1f147d898b051a04a8186b3ef232..d3a111fc9d13c2405de7b572ebf8cb9a423188a1 100755
--- a/base/server/sbin/pkispawn
+++ b/base/server/sbin/pkispawn
@@ -568,25 +568,20 @@ def main(argv):
         deployer.mdict['pki_manifest'],
         deployer.mdict['pki_manifest_spawn_archive'])
 
-    config.pki_log.debug(log.PKI_DICTIONARY_MASTER,
-                         extra=config.PKI_INDENTATION_LEVEL_0)
-    config.pki_log.debug(pkilogging.log_format(parser.mdict),
-                         extra=config.PKI_INDENTATION_LEVEL_0)
-
     external = deployer.configuration_file.external
     standalone = deployer.configuration_file.standalone
     step_one = deployer.configuration_file.external_step_one
     skip_configuration = deployer.configuration_file.skip_configuration
 
-    if external and step_one:
+    if skip_configuration:
+        print_skip_configuration_information(parser.mdict)
+
+    elif external and step_one:
         print_external_ca_step_one_information(parser.mdict)
 
     elif standalone and step_one:
         print_standalone_step_one_information(parser.mdict)
 
-    elif skip_configuration:
-        print_skip_configuration_information(parser.mdict)
-
     else:
         print_final_install_information(parser.mdict)
 
-- 
2.4.11

