Skip to content

Commit

Permalink
Clean up subsystem_layout.py
Browse files Browse the repository at this point in the history
The code that creates the symlinks has been moved into
PKISubsystem.create(), create_conf(), and create_logs().
  • Loading branch information
edewata committed Dec 4, 2023
1 parent 9de2d9c commit ef66910
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,36 +295,6 @@ def spawn(self, deployer):
pki_target_phone_home_xml,
params=deployer.mdict)

# Link /var/lib/pki/<instance>/<subsystem>/conf
# to /etc/pki/<instance>/<subsystem>

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/<instance>/<subsystem>/logs
# to /var/log/pki/<instance>/<subsystem>

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/<instance>/<subsystem>/registry
# to /etc/sysconfig/pki/tomcat/<instance>

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)
Expand Down
27 changes: 27 additions & 0 deletions base/server/python/pki/server/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,29 @@ def create(self, exist_ok=False):
# Create /var/lib/pki/<instance>/<subsystem>
self.instance.makedirs(self.base_dir, exist_ok=exist_ok)

# Link /var/lib/pki/<instance>/<subsystem>/registry
# to /etc/sysconfig/pki/tomcat/<instance>

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/<instance>/<subsystem>
self.instance.makedirs(self.conf_dir, exist_ok=exist_ok)

# Link /var/lib/pki/<instance>/<subsystem>/conf
# to /etc/pki/<instance>/<subsystem>

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'
Expand All @@ -175,6 +193,15 @@ def create_logs(self, exist_ok=False):
# Create /var/log/pki/<instance>/<subsystem>
self.instance.makedirs(self.log_dir, exist_ok=exist_ok)

# Link /var/lib/pki/<instance>/<subsystem>/logs
# to /var/log/pki/<instance>/<subsystem>

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/<instance>/<subsystem>/archive
self.instance.makedirs(self.log_archive_dir, exist_ok=exist_ok)

Expand Down

0 comments on commit ef66910

Please sign in to comment.