From d5bc2ead8c73943c0053198fb3ba9959a78b2b41 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. The constants in pkiconfig.py have been moved into a new PKIConfig class. All references have been modified accordingly. Ticket #380 --- base/deploy/src/pkidestroy | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'base/deploy/src/pkidestroy') diff --git a/base/deploy/src/pkidestroy b/base/deploy/src/pkidestroy index 1597712e1..f5c6f1bf2 100755 --- a/base/deploy/src/pkidestroy +++ b/base/deploy/src/pkidestroy @@ -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() @@ -97,7 +98,7 @@ def main(argv): # Enable 'pkidestroy' logging. 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() +\ "-" + "destroy" + "." +\ @@ -117,45 +118,45 @@ 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) # Combine the various sectional dictionaries into a PKI master dictionary parser.compose_pki_master_dictionary() config.pki_master_dict['pki_destroy_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) # Remove the specified PKI subsystem. pki_scriptlets_path = "/usr/share/pki/deployment/destroy" +\ @@ -164,7 +165,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() @@ -180,9 +181,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