Skip to content

Commit

Permalink
Remove PKIDeployer.pki_instance_subsystems()
Browse files Browse the repository at this point in the history
The PKIDeployer.pki_instance_subsystems() has been replaced
with PKIServer.get_subsystems().
  • Loading branch information
edewata committed Jul 17, 2023
1 parent f3ee524 commit eebce74
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 42 deletions.
33 changes: 0 additions & 33 deletions base/server/python/pki/server/deployment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,39 +417,6 @@ def get_key_params(self, cert_id):

return (key_type, key_size, curve, hash_alg)

def pki_instance_subsystems(self):

rv = 0

# Since ALL directories within the top-level PKI infrastructure
# SHOULD represent PKI instances, look for all possible
# PKI instances within the top-level PKI infrastructure

for instance in os.listdir(pki.server.PKIServer.BASE_DIR):

instance_dir = os.path.join(pki.server.PKIServer.BASE_DIR, instance)
if not os.path.isdir(instance_dir) or os.path.islink(instance_dir):
continue

# Since ANY directory within this PKI instance COULD
# be a PKI subsystem, look for all possible
# PKI subsystems within this PKI instance

for name in os.listdir(instance_dir):

subsystem_dir = os.path.join(instance_dir, name)
if not os.path.isdir(subsystem_dir) or os.path.islink(subsystem_dir):
continue

if name.upper() in config.PKI_SUBSYSTEMS:
rv += 1

logger.debug(
log.PKIHELPER_PKI_INSTANCE_SUBSYSTEMS_2,
self.mdict['pki_instance_path'], rv)

return rv

def tomcat_instance_subsystems(self):

# Return list of PKI subsystems in the specified tomcat instance
Expand Down
2 changes: 0 additions & 2 deletions base/server/python/pki/server/deployment/pkimessages.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@
PKIHELPER_UNREGISTERED_SECURITY_MODULE_1 = \
"security module '%s' is not registered."

PKIHELPER_PKI_INSTANCE_SUBSYSTEMS_2 = \
"instance '%s' contains '%d' PKI subsystems"
PKIHELPER_REMOVE_FILTER_SECTION_1 = "removing filter section from '%s'"
PKIHELPER_RM_F_1 = "rm -f %s"
PKIHELPER_RM_RF_1 = "rm -rf %s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ def destroy(self, deployer):
instance = self.instance
instance.load()

# If this is the last remaining PKI instance, ALWAYS remove the
# link to start configured PKI instances upon system reboot
if deployer.pki_instance_subsystems() == 0:
instance.disable()

# Start this Tomcat PKI Process back if there are any subsystems still existing
if len(deployer.tomcat_instance_subsystems()) >= 1:
if instance.get_subsystems():
# If there's more subsystems, restart server
logger.info('Starting PKI server')
instance.start(
wait=True,
max_wait=deployer.startup_timeout,
timeout=deployer.request_timeout)

else:
# If there's no more subsystems, disable server
logger.info('Disabling PKI server')
instance.disable()

logger.info(log.PKIDESTROY_END_MESSAGE_2,
deployer.mdict['pki_subsystem'],
deployer.mdict['pki_instance_name'])

0 comments on commit eebce74

Please sign in to comment.