From 126911eac9bc32f167b0f67e9801528b762af51e Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Tue, 13 Nov 2012 22:31:37 -0500 Subject: Refactored constants in pkiconfig.py. --- base/deploy/src/pkispawn | 49 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'base/deploy/src/pkispawn') diff --git a/base/deploy/src/pkispawn b/base/deploy/src/pkispawn index a687d5bef..ff411c6c4 100755 --- a/base/deploy/src/pkispawn +++ b/base/deploy/src/pkispawn @@ -36,6 +36,7 @@ try: import time from time import strftime as date from pki.deployment import pkiconfig as config + from pki.deployment.pkiconfig import PKIConfig from pki.deployment.pkiparser import PKIConfigParser from pki.deployment import pkilogging from pki.deployment import pkimessages as log @@ -58,7 +59,7 @@ def main(argv): sys.exit("'%s' must be run as root!" % argv[0]) # Set the umask - os.umask(config.PKI_DEPLOYMENT_DEFAULT_UMASK) + os.umask(PKIConfig.PKI_DEPLOYMENT_DEFAULT_UMASK) # Set installation time ticks = time.time() @@ -95,7 +96,7 @@ def main(argv): parser = PKIConfigParser() parser.process_command_line_arguments(argv) - if not os.path.exists(config.PKI_DEPLOYMENT_SOURCE_ROOT +\ + if not os.path.exists(PKIConfig.PKI_DEPLOYMENT_SOURCE_ROOT +\ "/" + config.pki_subsystem.lower()): print "ERROR: " + log.PKI_SUBSYSTEM_NOT_INSTALLED_1 %\ config.pki_subsystem.lower() @@ -105,7 +106,7 @@ def main(argv): rv = 0 if not config.pki_update_flag: config.pki_log_dir = config.pki_root_prefix +\ - config.PKI_DEPLOYMENT_LOG_ROOT + PKIConfig.PKI_DEPLOYMENT_LOG_ROOT config.pki_log_name = "pki" + "-" +\ config.pki_subsystem.lower() +\ "-" + "spawn" + "." +\ @@ -117,7 +118,7 @@ def main(argv): "pkispawn") else: config.pki_log_dir = config.pki_root_prefix +\ - config.PKI_DEPLOYMENT_LOG_ROOT + PKIConfig.PKI_DEPLOYMENT_LOG_ROOT config.pki_log_name = "pki" + "-" +\ config.pki_subsystem.lower() +\ "-" + "respawn" + "." +\ @@ -137,43 +138,43 @@ def main(argv): rv = parser.read_pki_configuration_file() if rv != 0: config.pki_log.error(PKI_UNABLE_TO_PARSE_1, rv, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) sys.exit(1) else: # NEVER print out 'sensitive' name/value pairs!!! config.pki_log.debug(log.PKI_DICTIONARY_COMMON, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_common_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_web_server_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_subsystem_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # NEVER print out 'sensitive' name/value pairs!!! config.pki_log.debug(log.PKI_DICTIONARY_COMMON, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_common_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_web_server_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_subsystem_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # Read in the PKI slots configuration file. parser.compose_pki_slots_dictionary() config.pki_log.debug(log.PKI_DICTIONARY_SLOTS, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_slots_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # Combine the various sectional dictionaries into a PKI master dictionary parser.compose_pki_master_dictionary() @@ -184,9 +185,9 @@ def main(argv): config.pki_master_dict['pki_respawn_log'] = config.pki_log_dir + "/" +\ config.pki_log_name config.pki_log.debug(log.PKI_DICTIONARY_MASTER, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_master_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # Install and configure the specified PKI subsystem. pki_scriptlets_path = "/usr/share/pki/deployment/spawn" +\ @@ -195,7 +196,7 @@ def main(argv): not os.path.isdir(pki_scriptlets_path): config.pki_log.error(log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, pki_scriptlets_path, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) sys.exit(1) pki_subsystem_scriptlets = os.listdir(pki_scriptlets_path) pki_subsystem_scriptlets.sort() @@ -214,9 +215,9 @@ def main(argv): if rv != 0: sys.exit(1) config.pki_log.debug(log.PKI_DICTIONARY_MASTER, - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) config.pki_log.debug(pp.pformat(config.pki_master_dict), - extra=config.PKI_INDENTATION_LEVEL_0) + extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # PKI Deployment Entry Point -- cgit