Skip to content

Commit

Permalink
Replace pki_subsystem with PKIDeployer.subsystem_type
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Nov 15, 2023
1 parent c5bb984 commit 20f1799
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 23 deletions.
12 changes: 6 additions & 6 deletions base/server/python/pki/server/deployment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,12 +1009,12 @@ def verify_subsystem_exists(self):

logger.error(
log.PKI_SUBSYSTEM_DOES_NOT_EXIST_2,
self.mdict['pki_subsystem'],
self.subsystem_type,
self.mdict['pki_instance_name'])

raise Exception(
log.PKI_SUBSYSTEM_DOES_NOT_EXIST_2 % (
self.mdict['pki_subsystem'],
self.subsystem_type,
self.mdict['pki_instance_name']))

def verify_subsystem_does_not_exist(self):
Expand All @@ -1028,7 +1028,7 @@ def verify_subsystem_does_not_exist(self):

raise Exception(
log.PKI_SUBSYSTEM_ALREADY_EXISTS_2 % (
self.mdict['pki_subsystem'],
self.subsystem_type,
self.mdict['pki_instance_name']))

def init_subsystem(self, subsystem):
Expand Down Expand Up @@ -2422,7 +2422,7 @@ def get_install_token(self):
logger.info('Getting install token')

hostname = self.mdict['pki_hostname']
subsystem = self.mdict['pki_subsystem']
subsystem = self.subsystem_type

sd_client = pki.system.SecurityDomainClient(self.sd_connection)
install_token = sd_client.get_install_token(hostname, subsystem)
Expand Down Expand Up @@ -4652,7 +4652,7 @@ def finalize_subsystem(self, subsystem):

def store_config(self):

subsystem = self.instance.get_subsystem(self.mdict['pki_subsystem'].lower())
subsystem = self.instance.get_subsystem(self.subsystem_type.lower())

# Store user's deployment.cfg into
# /etc/sysconfig/pki/tomcat/<instance>/<subsystem>/deployment.cfg
Expand All @@ -4677,7 +4677,7 @@ def store_config(self):

def store_manifest(self):

subsystem = self.instance.get_subsystem(self.mdict['pki_subsystem'].lower())
subsystem = self.instance.get_subsystem(self.subsystem_type.lower())

# Store installation manifest into
# /etc/sysconfig/pki/tomcat/<instance>/<subsystem>/manifest
Expand Down
2 changes: 1 addition & 1 deletion base/server/python/pki/server/deployment/pkihelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def __init__(self, deployer):
self.subordinate = config.str2bool(self.mdict['pki_subordinate'])

# set useful 'string' object variables for this class
self.subsystem = self.mdict['pki_subsystem']
self.subsystem = deployer.subsystem_type

def confirm_external(self):
# ALWAYS defined via 'pkiparser.py'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def spawn(self, deployer):
instance = self.instance
instance.load()

subsystem = instance.get_subsystem(deployer.mdict['pki_subsystem'].lower())
subsystem = instance.get_subsystem(deployer.subsystem_type.lower())

deployer.configure_subsystem(subsystem)
subsystem.save()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ def spawn(self, deployer):
instance = self.instance
instance.load()

subsystem = instance.get_subsystem(deployer.mdict['pki_subsystem'].lower())
subsystem = instance.get_subsystem(deployer.subsystem_type.lower())

if config.str2bool(deployer.mdict['pki_backup_keys']):

# by default store the backup file in the NSS databases directory
if not deployer.mdict['pki_backup_file']:
deployer.mdict['pki_backup_file'] = \
instance.nssdb_dir + '/' + \
deployer.mdict['pki_subsystem'].lower() + '_backup_keys.p12'
deployer.subsystem_type.lower() + '_backup_keys.p12'

logger.info('Backing up keys into %s', deployer.mdict['pki_backup_file'])
deployer.backup_keys(subsystem)
Expand Down Expand Up @@ -96,7 +96,7 @@ def spawn(self, deployer):

# Log final process messages
logger.info(log.PKISPAWN_END_MESSAGE_2,
deployer.mdict['pki_subsystem'],
deployer.subsystem_type,
instance.name)

def destroy(self, deployer):
Expand All @@ -120,5 +120,5 @@ def destroy(self, deployer):
instance.disable()

logger.info(log.PKIDESTROY_END_MESSAGE_2,
deployer.mdict['pki_subsystem'],
deployer.subsystem_type,
instance.name)
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def spawn(self, deployer):
instance = self.instance

logger.info(log.PKISPAWN_BEGIN_MESSAGE_2,
deployer.mdict['pki_subsystem'],
deployer.subsystem_type,
instance.name)

instance.load()
Expand Down Expand Up @@ -179,14 +179,14 @@ def destroy(self, deployer):
instance = self.instance

logger.info(log.PKIDESTROY_BEGIN_MESSAGE_2,
deployer.mdict['pki_subsystem'],
deployer.subsystem_type,
instance.name)

logger.info('Initialization')

instance.load()

subsystem = instance.get_subsystem(deployer.mdict['pki_subsystem'].lower())
subsystem = instance.get_subsystem(deployer.subsystem_type.lower())

try:
# verify that this type of "subsystem" currently EXISTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def spawn(self, deployer):
instance = self.instance
instance.load()

subsystem = instance.get_subsystem(
deployer.mdict['pki_subsystem'].lower())
subsystem = instance.get_subsystem(deployer.subsystem_type.lower())

external = deployer.configuration_file.external
standalone = deployer.configuration_file.standalone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def spawn(self, deployer):
instance = self.instance
instance.load()

subsystem = instance.get_subsystem(deployer.mdict['pki_subsystem'].lower())
subsystem = instance.get_subsystem(deployer.subsystem_type.lower())

if config.str2bool(deployer.mdict['pki_use_pss_rsa_signing_algorithm']):
deployer.update_rsa_pss_algorithms(subsystem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def spawn(self, deployer):
logger.info('Skipping subsystem creation')
return

logger.info('Creating %s subsystem', deployer.mdict['pki_subsystem'])
logger.info('Creating %s subsystem', deployer.subsystem_type)

# If pki_one_time_pin is not specified, generate a new one
if 'pki_one_time_pin' not in deployer.mdict:
Expand Down Expand Up @@ -96,7 +96,7 @@ def spawn(self, deployer):
pki_source_registry_cfg,
pki_target_registry_cfg)

if deployer.mdict['pki_subsystem'] == "CA":
if deployer.subsystem_type == "CA":

# Copy /usr/share/pki/ca/emails
# to /etc/pki/<instance>/ca/emails
Expand Down Expand Up @@ -278,7 +278,7 @@ def spawn(self, deployer):
pki_target_proxy_conf,
params=deployer.mdict)

elif deployer.mdict['pki_subsystem'] == "TPS":
elif deployer.subsystem_type == "TPS":

# Copy /usr/share/pki/<subsystem>/conf/phoneHome.xml
# to /etc/pki/<instance>/<subsystem>/phoneHome.xml
Expand Down Expand Up @@ -332,14 +332,14 @@ def spawn(self, deployer):
def destroy(self, deployer):

instance = self.instance
subsystem_name = deployer.mdict['pki_subsystem'].lower()
subsystem_name = deployer.subsystem_type.lower()

logger.info('Undeploying /%s web application', subsystem_name)

subsystem = instance.get_subsystem(subsystem_name)
subsystem.disable(force=deployer.force)

logger.info('Removing %s subsystem', deployer.mdict['pki_subsystem'])
logger.info('Removing %s subsystem', deployer.subsystem_type)

instance.remove_subsystem(subsystem)

Expand Down

0 comments on commit 20f1799

Please sign in to comment.