diff options
author | Endi S. Dewata <edewata@redhat.com> | 2016-04-27 04:58:12 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2016-04-30 00:19:39 +0200 |
commit | 6d37d95354b46846a055fcc8cdcf7f5f88ab729e (patch) | |
tree | c19dd83d6d737adf9bb629b498e3856e4a79430d /base/server/python | |
parent | efaa21dddc68bc4ff60b1c2a24bef9b23b0bb73b (diff) | |
download | pki-6d37d95354b46846a055fcc8cdcf7f5f88ab729e.tar.gz pki-6d37d95354b46846a055fcc8cdcf7f5f88ab729e.tar.xz pki-6d37d95354b46846a055fcc8cdcf7f5f88ab729e.zip |
Fixed duplicate executions of finalization scriptlet.
Previously the finalization scriptlet was always executed in each
pkispawn execution. In multi-step installations (e.g. external CA,
standalone, or installation/configuration-only mode) some of the
code in the scriptlet such as enabling systemd service, restarting
the service, and purging client database will be redundant.
Now the scriptlet has been modified to execute only in the final
step of the installation. The code that archives the deployment
and manifest files has been moved into pkispawn to ensure that it
is always executed in each pkispawn execution.
For clarity the method that displays the installation summary has
been broken up into separate methods for standalone step 1,
installation-only mode, and configuration-only/full installation.
Diffstat (limited to 'base/server/python')
-rw-r--r-- | base/server/python/pki/server/deployment/pkimessages.py | 3 | ||||
-rw-r--r-- | base/server/python/pki/server/deployment/scriptlets/finalization.py | 42 |
2 files changed, 15 insertions, 30 deletions
diff --git a/base/server/python/pki/server/deployment/pkimessages.py b/base/server/python/pki/server/deployment/pkimessages.py index b58915fe2..c8821bbb6 100644 --- a/base/server/python/pki/server/deployment/pkimessages.py +++ b/base/server/python/pki/server/deployment/pkimessages.py @@ -98,7 +98,8 @@ PKI_SUBORDINATE_UNSUPPORTED_1 = \ PKI_IOERROR_1 = "IOError: %s!" PKI_KEYERROR_1 = "KeyError: %s!" PKI_LARGEZIPFILE_ERROR_1 = "zipfile.LargeZipFile: %s!" -PKI_MANIFEST_MESSAGE_1 = "generating manifest file called '%s'" +PKI_ARCHIVE_CONFIG_MESSAGE_1 = "archiving configuration into '%s'" +PKI_ARCHIVE_MANIFEST_MESSAGE_1 = "archiving manifest into '%s'" PKI_OSERROR_1 = "OSError: %s!" PKI_SHUTIL_ERROR_1 = "shutil.Error: %s!" PKI_SUBPROCESS_ERROR_1 = "subprocess.CalledProcessError: %s!" diff --git a/base/server/python/pki/server/deployment/scriptlets/finalization.py b/base/server/python/pki/server/deployment/scriptlets/finalization.py index 8f8cfe0ac..3dc7f66de 100644 --- a/base/server/python/pki/server/deployment/scriptlets/finalization.py +++ b/base/server/python/pki/server/deployment/scriptlets/finalization.py @@ -22,7 +22,6 @@ from __future__ import absolute_import # PKI Deployment Imports from .. import pkiconfig as config -from .. import pkimanifest as manifest from .. import pkimessages as log from .. import pkiscriptlet @@ -32,30 +31,19 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self, deployer): - # ALWAYS finalize execution of scriptlets + 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 or standalone) and step_one or skip_configuration: + config.pki_log.info(log.SKIP_FINALIZATION_SPAWN_1, __name__, + extra=config.PKI_INDENTATION_LEVEL_1) + return + config.pki_log.info(log.FINALIZATION_SPAWN_1, __name__, extra=config.PKI_INDENTATION_LEVEL_1) - # For debugging/auditing purposes, save a timestamped copy of - # this configuration file in the subsystem archive - deployer.file.copy( - deployer.mdict['pki_user_deployment_cfg_replica'], - deployer.mdict['pki_user_deployment_cfg_spawn_archive']) - # Save a copy of the installation manifest file - config.pki_log.info( - log.PKI_MANIFEST_MESSAGE_1, deployer.mdict['pki_manifest'], - extra=config.PKI_INDENTATION_LEVEL_2) - # for record in manifest.database: - # print tuple(record) - manifest_file = manifest.File(deployer.manifest_db) - manifest_file.register(deployer.mdict['pki_manifest']) - manifest_file.write() - deployer.file.modify(deployer.mdict['pki_manifest'], silent=True) - # Also, for debugging/auditing purposes, save a timestamped copy of - # this installation manifest file - deployer.file.copy( - deployer.mdict['pki_manifest'], - deployer.mdict['pki_manifest_spawn_archive']) # Optionally, programmatically 'enable' the configured PKI instance # to be started upon system boot (default is True) if not config.str2bool(deployer.mdict['pki_enable_on_system_boot']): @@ -66,13 +54,9 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): # Modify contents of 'serverCertNick.conf' (if necessary) deployer.servercertnick_conf.modify() - external = config.str2bool(deployer.mdict['pki_external']) - step_one = not config.str2bool(deployer.mdict['pki_external_step_two']) - - if not (external and step_one): - # Optionally, programmatically 'restart' the configured PKI instance - if config.str2bool(deployer.mdict['pki_restart_configured_instance']): - deployer.systemd.restart() + # Optionally, programmatically 'restart' the configured PKI instance + if config.str2bool(deployer.mdict['pki_restart_configured_instance']): + deployer.systemd.restart() # Optionally, 'purge' the entire temporary client infrastructure # including the client NSS security databases and password files |