From ef66910b5bd79eb3bd2f99b3248d8195373b8498 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 4 Dec 2023 07:52:25 +0700 Subject: [PATCH] Clean up subsystem_layout.py The code that creates the symlinks has been moved into PKISubsystem.create(), create_conf(), and create_logs(). --- .../deployment/scriptlets/subsystem_layout.py | 30 ------------------- base/server/python/pki/server/subsystem.py | 27 +++++++++++++++++ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/base/server/python/pki/server/deployment/scriptlets/subsystem_layout.py b/base/server/python/pki/server/deployment/scriptlets/subsystem_layout.py index d783bdaac7c..0b8624d9e7c 100644 --- a/base/server/python/pki/server/deployment/scriptlets/subsystem_layout.py +++ b/base/server/python/pki/server/deployment/scriptlets/subsystem_layout.py @@ -295,36 +295,6 @@ def spawn(self, deployer): pki_target_phone_home_xml, params=deployer.mdict) - # Link /var/lib/pki///conf - # to /etc/pki// - - subsystem_conf_link = os.path.join(subsystem.base_dir, 'conf') - - instance.symlink( - subsystem.conf_dir, - subsystem_conf_link, - exist_ok=True) - - # Link /var/lib/pki///logs - # to /var/log/pki// - - subsystem_logs_link = os.path.join(subsystem.base_dir, 'logs') - - instance.symlink( - subsystem.log_dir, - subsystem_logs_link, - exist_ok=True) - - # Link /var/lib/pki///registry - # to /etc/sysconfig/pki/tomcat/ - - registry_link = os.path.join(subsystem.base_dir, 'registry') - - instance.symlink( - instance.registry_dir, - registry_link, - exist_ok=True) - instance.load() subsystem = instance.get_subsystem(subsystem_name) diff --git a/base/server/python/pki/server/subsystem.py b/base/server/python/pki/server/subsystem.py index 30ecbf59d95..f8b68bca797 100644 --- a/base/server/python/pki/server/subsystem.py +++ b/base/server/python/pki/server/subsystem.py @@ -146,11 +146,29 @@ def create(self, exist_ok=False): # Create /var/lib/pki// self.instance.makedirs(self.base_dir, exist_ok=exist_ok) + # Link /var/lib/pki///registry + # to /etc/sysconfig/pki/tomcat/ + + registry_link = os.path.join(self.base_dir, 'registry') + self.instance.symlink( + self.instance.registry_dir, + registry_link, + exist_ok=True) + def create_conf(self, exist_ok=False): # Create /etc/pki// self.instance.makedirs(self.conf_dir, exist_ok=exist_ok) + # Link /var/lib/pki///conf + # to /etc/pki// + + conf_link = os.path.join(self.base_dir, 'conf') + self.instance.symlink( + self.conf_dir, + conf_link, + exist_ok=exist_ok) + self.config['cs.type'] = self.type self.config['instanceId'] = self.instance.name self.config['passwordClass'] = 'com.netscape.cmsutil.password.PlainPasswordFile' @@ -175,6 +193,15 @@ def create_logs(self, exist_ok=False): # Create /var/log/pki// self.instance.makedirs(self.log_dir, exist_ok=exist_ok) + # Link /var/lib/pki///logs + # to /var/log/pki// + + logs_link = os.path.join(self.base_dir, 'logs') + self.instance.symlink( + self.log_dir, + logs_link, + exist_ok=exist_ok) + # Create /var/log/pki///archive self.instance.makedirs(self.log_archive_dir, exist_ok=exist_ok)