diff --git a/base/server/etc/default.cfg b/base/server/etc/default.cfg index 1c665dc3729..044347de623 100644 --- a/base/server/etc/default.cfg +++ b/base/server/etc/default.cfg @@ -34,19 +34,6 @@ sensitive_parameters= pki_server_pkcs12_password pki_token_password -# The destroy_scriplets contains a list of scriplets to be executed by pkidestroy. -destroy_scriplets= - initialization - configuration - keygen - subsystem_layout - security_databases - instance_layout - selinux_setup - infrastructure_layout - finalization - fapolicy_setup - pki_instance_name=pki-tomcat pki_http_port=8080 pki_https_port=8443 diff --git a/base/server/python/pki/server/deployment/__init__.py b/base/server/python/pki/server/deployment/__init__.py index 5f5e010a3d9..3de8862579b 100644 --- a/base/server/python/pki/server/deployment/__init__.py +++ b/base/server/python/pki/server/deployment/__init__.py @@ -4828,3 +4828,57 @@ def spawn(self): scriptlet.deployer = self scriptlet.instance = self.instance scriptlet.spawn(self) + + def destroy(self): + + print('Uninstalling ' + self.subsystem_name + ' from ' + self.instance.base_dir + '.') + + scriptlet = pki.server.deployment.scriptlets.initialization.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.configuration.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.keygen.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.subsystem_layout.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.security_databases.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.instance_layout.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.selinux_setup.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.infrastructure_layout.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.finalization.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) + + scriptlet = pki.server.deployment.scriptlets.fapolicy_setup.PkiScriptlet() + scriptlet.deployer = self + scriptlet.instance = self.instance + scriptlet.destroy(self) diff --git a/base/server/python/pki/server/pkidestroy.py b/base/server/python/pki/server/pkidestroy.py index 72b3aaf45a4..5a9f9edef27 100644 --- a/base/server/python/pki/server/pkidestroy.py +++ b/base/server/python/pki/server/pkidestroy.py @@ -227,23 +227,8 @@ def main(argv): logger.debug(log.PKI_DICTIONARY_MASTER) logger.debug(pkilogging.log_format(parser.mdict)) - print("Uninstalling " + deployer.subsystem_name + " from " + - deployer.instance.base_dir + ".") - - # Process the various "scriptlets" to remove the specified PKI subsystem. - pki_subsystem_scriptlets = parser.mdict['destroy_scriplets'].split() - try: - for scriptlet_name in pki_subsystem_scriptlets: - - scriptlet_module = __import__( - "pki.server.deployment.scriptlets." + scriptlet_name, - fromlist=[scriptlet_name]) - - scriptlet = scriptlet_module.PkiScriptlet() - scriptlet.deployer = deployer - scriptlet.instance = deployer.instance - scriptlet.destroy(deployer) + deployer.destroy() except subprocess.CalledProcessError as e: log_error_details()