From afc1e1c37095faed52f0a6166547da27d93d2326 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Tue, 13 Nov 2012 23:00:07 -0500 Subject: Refactored log variables in pkiconfig.py. The log variables in pkiconfig.py have been moved into pkilogging.py for better clarity. Ticket #380 --- base/deploy/src/pkidestroy | 56 +-- base/deploy/src/pkispawn | 60 +-- base/deploy/src/scriptlets/configuration.py | 7 +- base/deploy/src/scriptlets/finalization.py | 13 +- .../deploy/src/scriptlets/infrastructure_layout.py | 7 +- base/deploy/src/scriptlets/initialization.py | 11 +- base/deploy/src/scriptlets/instance_layout.py | 7 +- base/deploy/src/scriptlets/pkiconfig.py | 9 - base/deploy/src/scriptlets/pkihelper.py | 479 +++++++++++---------- base/deploy/src/scriptlets/pkilogging.py | 9 + base/deploy/src/scriptlets/pkimanifest.py | 5 +- base/deploy/src/scriptlets/pkiparser.py | 31 +- base/deploy/src/scriptlets/security_databases.py | 7 +- base/deploy/src/scriptlets/selinux_setup.py | 27 +- base/deploy/src/scriptlets/slot_substitution.py | 9 +- base/deploy/src/scriptlets/subsystem_layout.py | 7 +- base/deploy/src/scriptlets/webapp_deployment.py | 7 +- 17 files changed, 382 insertions(+), 369 deletions(-) diff --git a/base/deploy/src/pkidestroy b/base/deploy/src/pkidestroy index f5c6f1bf2..fd99d5eae 100755 --- a/base/deploy/src/pkidestroy +++ b/base/deploy/src/pkidestroy @@ -97,65 +97,65 @@ def main(argv): parser.process_command_line_arguments(argv) # Enable 'pkidestroy' logging. - config.pki_log_dir = config.pki_root_prefix +\ + pkilogging.pki_log_dir = config.pki_root_prefix +\ PKIConfig.PKI_DEPLOYMENT_LOG_ROOT - config.pki_log_name = "pki" + "-" +\ + pkilogging.pki_log_name = "pki" + "-" +\ config.pki_subsystem.lower() +\ "-" + "destroy" + "." +\ config.pki_timestamp + "." + "log" - rv = pkilogging.enable_pki_logger(config.pki_log_dir, - config.pki_log_name, - config.pki_log_level, - config.pki_console_log_level, + rv = pkilogging.enable_pki_logger(pkilogging.pki_log_dir, + pkilogging.pki_log_name, + pkilogging.pki_log_level, + pkilogging.pki_console_log_level, "pkidestroy") if rv != OSError: - config.pki_log = rv + pkilogging.pki_log = rv else: - print log.PKI_UNABLE_TO_CREATE_LOG_DIRECTORY_1 % config.pki_log_dir + print log.PKI_UNABLE_TO_CREATE_LOG_DIRECTORY_1 % pkilogging.pki_log_dir sys.exit(1) # Read the specified PKI configuration file. rv = parser.read_pki_configuration_file() if rv != 0: - config.pki_log.error(PKI_UNABLE_TO_PARSE_1, rv, + pkilogging.pki_log.error(PKI_UNABLE_TO_PARSE_1, rv, 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, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_COMMON, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_common_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_common_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_web_server_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_web_server_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_subsystem_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_subsystem_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # NEVER print out 'sensitive' name/value pairs!!! - config.pki_log.debug(log.PKI_DICTIONARY_COMMON, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_COMMON, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_common_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_common_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_web_server_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_web_server_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_subsystem_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_subsystem_dict), 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, + config.pki_master_dict['pki_destroy_log'] = pkilogging.pki_log_dir + "/" +\ + pkilogging.pki_log_name + pkilogging.pki_log.debug(log.PKI_DICTIONARY_MASTER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_master_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_master_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # Remove the specified PKI subsystem. @@ -163,7 +163,7 @@ def main(argv): "/" + config.pki_subsystem.lower() if not os.path.exists(pki_scriptlets_path) or\ not os.path.isdir(pki_scriptlets_path): - config.pki_log.error(log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, + pkilogging.pki_log.error(log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, pki_scriptlets_path, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) sys.exit(1) @@ -180,9 +180,9 @@ def main(argv): rv = instance.destroy() if rv != 0: sys.exit(1) - config.pki_log.debug(log.PKI_DICTIONARY_MASTER, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_MASTER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_master_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_master_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) diff --git a/base/deploy/src/pkispawn b/base/deploy/src/pkispawn index 63a827fcb..94909e7e6 100755 --- a/base/deploy/src/pkispawn +++ b/base/deploy/src/pkispawn @@ -104,72 +104,72 @@ def main(argv): # Enable 'pkispawn' logging. rv = 0 - config.pki_log_dir = config.pki_root_prefix +\ + pkilogging.pki_log_dir = config.pki_root_prefix +\ PKIConfig.PKI_DEPLOYMENT_LOG_ROOT - config.pki_log_name = "pki" + "-" +\ + pkilogging.pki_log_name = "pki" + "-" +\ config.pki_subsystem.lower() +\ "-" + "spawn" + "." +\ config.pki_timestamp + "." + "log" - rv = pkilogging.enable_pki_logger(config.pki_log_dir, - config.pki_log_name, - config.pki_log_level, - config.pki_console_log_level, + rv = pkilogging.enable_pki_logger(pkilogging.pki_log_dir, + pkilogging.pki_log_name, + pkilogging.pki_log_level, + pkilogging.pki_console_log_level, "pkispawn") if rv != OSError: - config.pki_log = rv + pkilogging.pki_log = rv else: - print log.PKI_UNABLE_TO_CREATE_LOG_DIRECTORY_1 % config.pki_log_dir + print log.PKI_UNABLE_TO_CREATE_LOG_DIRECTORY_1 % pkilogging.pki_log_dir sys.exit(1) # Read the specified PKI configuration file. rv = parser.read_pki_configuration_file() if rv != 0: - config.pki_log.error(PKI_UNABLE_TO_PARSE_1, rv, + pkilogging.pki_log.error(PKI_UNABLE_TO_PARSE_1, rv, 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, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_COMMON, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_common_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_common_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_web_server_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_web_server_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_subsystem_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_subsystem_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # NEVER print out 'sensitive' name/value pairs!!! - config.pki_log.debug(log.PKI_DICTIONARY_COMMON, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_COMMON, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_common_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_common_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_web_server_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_web_server_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_subsystem_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_subsystem_dict), 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, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_SLOTS, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_slots_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_slots_dict), 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_spawn_log'] = config.pki_log_dir + "/" +\ - config.pki_log_name - config.pki_log.debug(log.PKI_DICTIONARY_MASTER, + config.pki_master_dict['pki_spawn_log'] = pkilogging.pki_log_dir + "/" +\ + pkilogging.pki_log_name + pkilogging.pki_log.debug(log.PKI_DICTIONARY_MASTER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_master_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_master_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) # Install and configure the specified PKI subsystem. @@ -177,7 +177,7 @@ def main(argv): "/" + config.pki_subsystem.lower() if not os.path.exists(pki_scriptlets_path) or\ not os.path.isdir(pki_scriptlets_path): - config.pki_log.error(log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, + pkilogging.pki_log.error(log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, pki_scriptlets_path, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) sys.exit(1) @@ -194,9 +194,9 @@ def main(argv): rv = instance.spawn() if rv != 0: sys.exit(1) - config.pki_log.debug(log.PKI_DICTIONARY_MASTER, + pkilogging.pki_log.debug(log.PKI_DICTIONARY_MASTER, extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pp.pformat(config.pki_master_dict), + pkilogging.pki_log.debug(pp.pformat(config.pki_master_dict), extra=PKIConfig.PKI_INDENTATION_LEVEL_0) diff --git a/base/deploy/src/scriptlets/configuration.py b/base/deploy/src/scriptlets/configuration.py index 44d017d72..07914b970 100644 --- a/base/deploy/src/scriptlets/configuration.py +++ b/base/deploy/src/scriptlets/configuration.py @@ -25,6 +25,7 @@ from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master from pkiconfig import pki_sensitive_dict as sensitive import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet @@ -35,10 +36,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_configuration']): - config.pki_log.info(log.SKIP_CONFIGURATION_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_CONFIGURATION_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.CONFIGURATION_SPAWN_1, __name__, + pkilogging.pki_log.info(log.CONFIGURATION_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # Place "slightly" less restrictive permissions on @@ -98,7 +99,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.CONFIGURATION_DESTROY_1, __name__, + pkilogging.pki_log.info(log.CONFIGURATION_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) if master['pki_subsystem'] in PKIConfig.PKI_APACHE_SUBSYSTEMS and\ util.instance.apache_instance_subsystems() == 1: diff --git a/base/deploy/src/scriptlets/finalization.py b/base/deploy/src/scriptlets/finalization.py index 2cc3ad203..f11e2ed73 100644 --- a/base/deploy/src/scriptlets/finalization.py +++ b/base/deploy/src/scriptlets/finalization.py @@ -25,6 +25,7 @@ from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master import pkihelper as util import pkimanifest as manifest +import pkilogging import pkimessages as log import pkiscriptlet @@ -35,17 +36,17 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_FINALIZATION_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_FINALIZATION_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.FINALIZATION_SPAWN_1, __name__, + pkilogging.pki_log.info(log.FINALIZATION_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # For debugging/auditing purposes, save a timestamped copy of # this configuration file in the subsystem archive util.file.copy(master['pki_deployment_cfg_replica'], master['pki_deployment_cfg_spawn_archive']) # Save a copy of the installation manifest file - config.pki_log.info(log.PKI_MANIFEST_MESSAGE_1, master['pki_manifest'], + pkilogging.pki_log.info(log.PKI_MANIFEST_MESSAGE_1, master['pki_manifest'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # for record in manifest.database: # print tuple(record) @@ -75,7 +76,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): if config.str2bool(master['pki_skip_configuration']): util.configuration_file.log_configuration_url() # Log final process messages - config.pki_log.info(log.PKISPAWN_END_MESSAGE_2, + pkilogging.pki_log.info(log.PKISPAWN_END_MESSAGE_2, master['pki_subsystem'], master['pki_instance_id'], extra=PKIConfig.PKI_INDENTATION_LEVEL_0) @@ -87,7 +88,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.FINALIZATION_DESTROY_1, __name__, + pkilogging.pki_log.info(log.FINALIZATION_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) util.file.modify(master['pki_destroy_log'], silent=True) # Start this Apache/Tomcat PKI Process @@ -97,7 +98,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): elif master['pki_subsystem'] in PKIConfig.PKI_TOMCAT_SUBSYSTEMS and\ util.instance.tomcat_instance_subsystems() >= 1: util.systemd.start() - config.pki_log.info(log.PKIDESTROY_END_MESSAGE_2, + pkilogging.pki_log.info(log.PKIDESTROY_END_MESSAGE_2, master['pki_subsystem'], master['pki_instance_id'], extra=PKIConfig.PKI_INDENTATION_LEVEL_0) diff --git a/base/deploy/src/scriptlets/infrastructure_layout.py b/base/deploy/src/scriptlets/infrastructure_layout.py index 9113e8131..5e86710f2 100644 --- a/base/deploy/src/scriptlets/infrastructure_layout.py +++ b/base/deploy/src/scriptlets/infrastructure_layout.py @@ -24,6 +24,7 @@ import pkiconfig as config from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet @@ -34,10 +35,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_ADMIN_DOMAIN_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_ADMIN_DOMAIN_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.ADMIN_DOMAIN_SPAWN_1, __name__, + pkilogging.pki_log.info(log.ADMIN_DOMAIN_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # NOTE: It was determined that since the "pkidestroy" command # relies upon a symbolic link to a replica of the original @@ -83,7 +84,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.ADMIN_DOMAIN_DESTROY_1, __name__, + pkilogging.pki_log.info(log.ADMIN_DOMAIN_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # remove top-level infrastructure base if master['pki_subsystem'] in PKIConfig.PKI_SUBSYSTEMS and\ diff --git a/base/deploy/src/scriptlets/initialization.py b/base/deploy/src/scriptlets/initialization.py index dead48fff..b64f52f1d 100644 --- a/base/deploy/src/scriptlets/initialization.py +++ b/base/deploy/src/scriptlets/initialization.py @@ -24,6 +24,7 @@ import pkiconfig as config from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet @@ -34,15 +35,15 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): # begin official logging - config.pki_log.info(log.PKISPAWN_BEGIN_MESSAGE_2, + pkilogging.pki_log.info(log.PKISPAWN_BEGIN_MESSAGE_2, master['pki_subsystem'], master['pki_instance_id'], extra=PKIConfig.PKI_INDENTATION_LEVEL_0) if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_INITIALIZATION_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_INITIALIZATION_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.INITIALIZATION_SPAWN_1, __name__, + pkilogging.pki_log.info(log.INITIALIZATION_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # verify that this type of "subsystem" does NOT yet # exist for this "instance" @@ -67,11 +68,11 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def destroy(self): # begin official logging - config.pki_log.info(log.PKIDESTROY_BEGIN_MESSAGE_2, + pkilogging.pki_log.info(log.PKIDESTROY_BEGIN_MESSAGE_2, master['pki_subsystem'], master['pki_instance_id'], extra=PKIConfig.PKI_INDENTATION_LEVEL_0) - config.pki_log.info(log.INITIALIZATION_DESTROY_1, __name__, + pkilogging.pki_log.info(log.INITIALIZATION_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # verify that this type of "subsystem" currently EXISTS # for this "instance" diff --git a/base/deploy/src/scriptlets/instance_layout.py b/base/deploy/src/scriptlets/instance_layout.py index c320e421d..aae9c0a0c 100644 --- a/base/deploy/src/scriptlets/instance_layout.py +++ b/base/deploy/src/scriptlets/instance_layout.py @@ -28,6 +28,7 @@ import pkiconfig as config from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet import os @@ -39,10 +40,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_INSTANCE_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_INSTANCE_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.INSTANCE_SPAWN_1, __name__, + pkilogging.pki_log.info(log.INSTANCE_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # establish instance logs util.directory.create(master['pki_instance_log_path']) @@ -146,7 +147,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.INSTANCE_DESTROY_1, __name__, + pkilogging.pki_log.info(log.INSTANCE_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) if master['pki_subsystem'] == 'TKS': util.symlink.delete(master['pki_symkey_jar_link']) diff --git a/base/deploy/src/scriptlets/pkiconfig.py b/base/deploy/src/scriptlets/pkiconfig.py index c1d22bf10..2544aa6cf 100644 --- a/base/deploy/src/scriptlets/pkiconfig.py +++ b/base/deploy/src/scriptlets/pkiconfig.py @@ -178,15 +178,6 @@ def wait_to_attach_an_external_java_debugger(): return -# PKI Deployment Logger Variables -pki_jython_log_level = None -pki_log = None -pki_log_dir = None -pki_log_name = None -pki_log_level = None -pki_console_log_level = None - - # PKI Deployment Global Dictionaries pki_sensitive_dict = None pki_common_dict = None diff --git a/base/deploy/src/scriptlets/pkihelper.py b/base/deploy/src/scriptlets/pkihelper.py index 59f69ba8f..6cf395e77 100644 --- a/base/deploy/src/scriptlets/pkihelper.py +++ b/base/deploy/src/scriptlets/pkihelper.py @@ -47,6 +47,7 @@ from pkiconfig import pki_sensitive_dict as sensitive from pkiconfig import pki_slots_dict as slots from pkiconfig import pki_selinux_config_ports as ports import pkimanifest as manifest +import pkilogging import pkimessages as log from pkiparser import PKIConfigParser @@ -131,17 +132,17 @@ class identity: # Does the specified 'pki_group' exist? pki_gid = getgrnam(pki_group)[2] # Yes, group 'pki_group' exists! - config.pki_log.info(log.PKIHELPER_GROUP_ADD_2, pki_group, pki_gid, + pkilogging.pki_log.info(log.PKIHELPER_GROUP_ADD_2, pki_group, pki_gid, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) except KeyError as exc: # No, group 'pki_group' does not exist! - config.pki_log.debug(log.PKIHELPER_GROUP_ADD_KEYERROR_1, exc, + pkilogging.pki_log.debug(log.PKIHELPER_GROUP_ADD_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) try: # Is the default well-known GID already defined? group = getgrgid(PKIConfig.PKI_DEPLOYMENT_DEFAULT_GID)[0] # Yes, the default well-known GID exists! - config.pki_log.info(log.PKIHELPER_GROUP_ADD_DEFAULT_2, + pkilogging.pki_log.info(log.PKIHELPER_GROUP_ADD_DEFAULT_2, group, PKIConfig.PKI_DEPLOYMENT_DEFAULT_GID, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Attempt to create 'pki_group' using a random GID. @@ -150,7 +151,7 @@ class identity: "> /dev/null 2>&1" except KeyError as exc: # No, the default well-known GID does not exist! - config.pki_log.debug(log.PKIHELPER_GROUP_ADD_GID_KEYERROR_1, + pkilogging.pki_log.debug(log.PKIHELPER_GROUP_ADD_GID_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Is the specified 'pki_group' the default well-known group? if pki_group == PKIConfig.PKI_DEPLOYMENT_DEFAULT_GROUP: @@ -170,7 +171,7 @@ class identity: # Execute this "groupadd" command. subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return @@ -181,18 +182,18 @@ class identity: # Does the specified 'pki_user' exist? pki_uid = getpwnam(pki_user)[2] # Yes, user 'pki_user' exists! - config.pki_log.info(log.PKIHELPER_USER_ADD_2, pki_user, pki_uid, + pkilogging.pki_log.info(log.PKIHELPER_USER_ADD_2, pki_user, pki_uid, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # NOTE: For now, never check validity of specified 'pki_group'! except KeyError as exc: # No, user 'pki_user' does not exist! - config.pki_log.debug(log.PKIHELPER_USER_ADD_KEYERROR_1, exc, + pkilogging.pki_log.debug(log.PKIHELPER_USER_ADD_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) try: # Is the default well-known UID already defined? user = getpwuid(PKIConfig.PKI_DEPLOYMENT_DEFAULT_UID)[0] # Yes, the default well-known UID exists! - config.pki_log.info(log.PKIHELPER_USER_ADD_DEFAULT_2, + pkilogging.pki_log.info(log.PKIHELPER_USER_ADD_DEFAULT_2, user, PKIConfig.PKI_DEPLOYMENT_DEFAULT_UID, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Attempt to create 'pki_user' using a random UID. @@ -209,7 +210,7 @@ class identity: "> /dev/null 2>&1" except KeyError as exc: # No, the default well-known UID does not exist! - config.pki_log.debug(log.PKIHELPER_USER_ADD_UID_KEYERROR_1, + pkilogging.pki_log.debug(log.PKIHELPER_USER_ADD_UID_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Is the specified 'pki_user' the default well-known user? if pki_user == PKIConfig.PKI_DEPLOYMENT_DEFAULT_USER: @@ -245,7 +246,7 @@ class identity: # Execute this "useradd" command. subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return @@ -259,7 +260,7 @@ class identity: try: pki_uid = master['pki_uid'] except KeyError as exc: - config.pki_log.error(log.PKI_KEYERROR_1, exc, + pkilogging.pki_log.error(log.PKI_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -269,7 +270,7 @@ class identity: try: pki_gid = master['pki_gid'] except KeyError as exc: - config.pki_log.error(log.PKI_KEYERROR_1, exc, + pkilogging.pki_log.error(log.PKI_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -277,15 +278,15 @@ class identity: def set_uid(self, name, critical_failure=True): try: - config.pki_log.debug(log.PKIHELPER_USER_1, name, + pkilogging.pki_log.debug(log.PKIHELPER_USER_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # id -u pki_uid = getpwnam(name)[2] master['pki_uid']=pki_uid - config.pki_log.debug(log.PKIHELPER_UID_2, name, pki_uid, + pkilogging.pki_log.debug(log.PKIHELPER_UID_2, name, pki_uid, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) except KeyError as exc: - config.pki_log.error(log.PKI_KEYERROR_1, exc, + pkilogging.pki_log.error(log.PKI_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -293,15 +294,15 @@ class identity: def set_gid(self, name, critical_failure=True): try: - config.pki_log.debug(log.PKIHELPER_GROUP_1, name, + pkilogging.pki_log.debug(log.PKIHELPER_GROUP_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # id -g pki_gid = getgrnam(name)[2] master['pki_gid']=pki_gid - config.pki_log.debug(log.PKIHELPER_GID_2, name, pki_gid, + pkilogging.pki_log.debug(log.PKIHELPER_GID_2, name, pki_gid, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) except KeyError as exc: - config.pki_log.error(log.PKI_KEYERROR_1, exc, + pkilogging.pki_log.error(log.PKI_KEYERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -317,7 +318,7 @@ class namespace: if os.path.exists(master['pki_instance_path']): if os.path.exists(master['pki_subsystem_path']): # Top-Level PKI base path collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_COLLISION_2, master['pki_instance_id'], master['pki_instance_path'], @@ -326,7 +327,7 @@ class namespace: else: if os.path.exists(master['pki_target_tomcat_conf_instance_id']): # Top-Level "/etc/sysconfig" path collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_COLLISION_2, master['pki_instance_id'], master['pki_target_tomcat_conf_instance_id'], @@ -334,7 +335,7 @@ class namespace: sys.exit(1) if os.path.exists(master['pki_cgroup_systemd_service']): # Systemd cgroup path collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_COLLISION_2, master['pki_instance_id'], master['pki_cgroup_systemd_service_path'], @@ -342,7 +343,7 @@ class namespace: sys.exit(1) if os.path.exists(master['pki_cgroup_cpu_systemd_service']): # Systemd cgroup CPU path collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_COLLISION_2, master['pki_instance_id'], master['pki_cgroup_cpu_systemd_service_path'], @@ -351,7 +352,7 @@ class namespace: if os.path.exists(master['pki_instance_log_path']) and\ os.path.exists(master['pki_subsystem_log_path']): # Top-Level PKI log path collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_COLLISION_2, master['pki_instance_id'], master['pki_instance_log_path'], @@ -360,7 +361,7 @@ class namespace: if os.path.exists(master['pki_instance_configuration_path']) and\ os.path.exists(master['pki_subsystem_configuration_path']): # Top-Level PKI configuration path collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_COLLISION_2, master['pki_instance_id'], master['pki_instance_configuration_path'], @@ -369,7 +370,7 @@ class namespace: if os.path.exists(master['pki_instance_registry_path']) and\ os.path.exists(master['pki_subsystem_registry_path']): # Top-Level PKI registry path collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_COLLISION_2, master['pki_instance_id'], master['pki_instance_registry_path'], @@ -378,7 +379,7 @@ class namespace: # Run simple checks for reserved name namespace collisions if master['pki_instance_id'] in PKIConfig.PKI_BASE_RESERVED_NAMES: # Top-Level PKI base path reserved name collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_RESERVED_NAME_2, master['pki_instance_id'], master['pki_instance_path'], @@ -387,7 +388,7 @@ class namespace: # No need to check for reserved name under Top-Level PKI log path if master['pki_instance_id'] in PKIConfig.PKI_CONFIGURATION_RESERVED_NAMES: # Top-Level PKI configuration path reserved name collision - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_RESERVED_NAME_2, master['pki_instance_id'], master['pki_instance_configuration_path'], @@ -397,7 +398,7 @@ class namespace: # Top-Level Apache PKI registry path reserved name collision if master['pki_instance_id'] in\ PKIConfig.PKI_APACHE_REGISTRY_RESERVED_NAMES: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_RESERVED_NAME_2, master['pki_instance_id'], master['pki_instance_registry_path'], @@ -407,7 +408,7 @@ class namespace: # Top-Level Tomcat PKI registry path reserved name collision if master['pki_instance_id'] in\ PKIConfig.PKI_TOMCAT_REGISTRY_RESERVED_NAMES: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_NAMESPACE_RESERVED_NAME_2, master['pki_instance_id'], master['pki_instance_registry_path'], @@ -420,10 +421,10 @@ class configuration_file: def log_configuration_url(self): # NOTE: This is the one and only parameter containing a sensitive # parameter that may be stored in a log file. - config.pki_log.info(log.PKI_CONFIGURATION_WIZARD_URL_1, + pkilogging.pki_log.info(log.PKI_CONFIGURATION_WIZARD_URL_1, sensitive['pki_configuration_url'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) - config.pki_log.info(log.PKI_CONFIGURATION_WIZARD_RESTART_1, + pkilogging.pki_log.info(log.PKI_CONFIGURATION_WIZARD_RESTART_1, master['pki_registry_initscript_command'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -442,7 +443,7 @@ class configuration_file: # Verify existence of Directory Server Password (ALWAYS) if not sensitive.has_key('pki_ds_password') or\ not len(sensitive['pki_ds_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_ds_password", master['pki_deployment_cfg'], @@ -452,7 +453,7 @@ class configuration_file: if not config.str2bool(master['pki_clone']): if not sensitive.has_key('pki_admin_password') or\ not len(sensitive['pki_admin_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_admin_password", master['pki_deployment_cfg'], @@ -462,7 +463,7 @@ class configuration_file: if config.str2bool(master['pki_backup_keys']): if not sensitive.has_key('pki_backup_password') or\ not len(sensitive['pki_backup_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_backup_password", master['pki_deployment_cfg'], @@ -471,7 +472,7 @@ class configuration_file: # Verify existence of Client Pin for NSS client security databases if not sensitive.has_key('pki_client_database_password') or\ not len(sensitive['pki_client_database_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CLIENT_DATABASE_PASSWORD_2, "pki_client_database_password", master['pki_deployment_cfg'], @@ -480,7 +481,7 @@ class configuration_file: # Verify existence of Client PKCS #12 Password for Admin Cert if not sensitive.has_key('pki_client_pkcs12_password') or\ not len(sensitive['pki_client_pkcs12_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_client_pkcs12_password", master['pki_deployment_cfg'], @@ -490,7 +491,7 @@ class configuration_file: if config.str2bool(master['pki_clone']): if not sensitive.has_key('pki_clone_pkcs12_password') or\ not len(sensitive['pki_clone_pkcs12_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_clone_pkcs12_password", master['pki_deployment_cfg'], @@ -503,7 +504,7 @@ class configuration_file: config.str2bool(master['pki_subordinate']): if not sensitive.has_key('pki_security_domain_password') or\ not len(sensitive['pki_security_domain_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_security_domain_password", master['pki_deployment_cfg'], @@ -513,7 +514,7 @@ class configuration_file: if not master['pki_token_name'] == "internal": if not sensitive.has_key('pki_token_password') or\ not len(sensitive['pki_token_password']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_token_password", master['pki_deployment_cfg'], @@ -528,28 +529,28 @@ class configuration_file: if config.str2bool(master['pki_clone']) and\ config.str2bool(master['pki_external']) and\ config.str2bool(master['pki_subordinate']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_MUTUALLY_EXCLUSIVE_CLONE_EXTERNAL_SUB_CA, master['pki_deployment_cfg'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) elif config.str2bool(master['pki_clone']) and\ config.str2bool(master['pki_external']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_MUTUALLY_EXCLUSIVE_CLONE_EXTERNAL_CA, master['pki_deployment_cfg'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) elif config.str2bool(master['pki_clone']) and\ config.str2bool(master['pki_subordinate']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_MUTUALLY_EXCLUSIVE_CLONE_SUB_CA, master['pki_deployment_cfg'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) elif config.str2bool(master['pki_external']) and\ config.str2bool(master['pki_subordinate']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_MUTUALLY_EXCLUSIVE_EXTERNAL_SUB_CA, master['pki_deployment_cfg'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -571,7 +572,7 @@ class configuration_file: # Verify existence of clone parameters if not master.has_key('pki_ds_base_dn') or\ not len(master['pki_ds_base_dn']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_ds_base_dn", master['pki_deployment_cfg'], @@ -582,7 +583,7 @@ class configuration_file: # FUTURE: Check for unused port value # (e. g. - must be different from master if the # master is located on the same host) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_ds_ldap_port", master['pki_deployment_cfg'], @@ -593,7 +594,7 @@ class configuration_file: # FUTURE: Check for unused port value # (e. g. - must be different from master if the # master is located on the same host) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_ds_ldaps_port", master['pki_deployment_cfg'], @@ -609,7 +610,7 @@ class configuration_file: # FUTURE: Check for unused port value # (e. g. - must be different from master if the # master is located on the same host) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_ajp_port", master['pki_deployment_cfg'], @@ -620,7 +621,7 @@ class configuration_file: # FUTURE: Check for unused port value # (e. g. - must be different from master if the # master is located on the same host) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_http_port", master['pki_deployment_cfg'], @@ -631,7 +632,7 @@ class configuration_file: # FUTURE: Check for unused port value # (e. g. - must be different from master if the # master is located on the same host) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_https_port", master['pki_deployment_cfg'], @@ -642,7 +643,7 @@ class configuration_file: # FUTURE: Check for unused port value # (e. g. - must be different from master if the # master is located on the same host) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_tomcat_server_port", master['pki_deployment_cfg'], @@ -650,21 +651,21 @@ class configuration_file: sys.exit(1) if not master.has_key('pki_clone_pkcs12_path') or\ not len(master['pki_clone_pkcs12_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_clone_pkcs12_path", master['pki_deployment_cfg'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) elif not os.path.isfile(master['pki_clone_pkcs12_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, master['pki_clone_pkcs12_path'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) if not master.has_key('pki_clone_replication_security') or\ not len(master['pki_clone_replication_security']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_clone_replication_security", master['pki_deployment_cfg'], @@ -672,7 +673,7 @@ class configuration_file: sys.exit(1) if not master.has_key('pki_clone_uri') or\ not len(master['pki_clone_uri']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_clone_uri", master['pki_deployment_cfg'], @@ -682,7 +683,7 @@ class configuration_file: config.str2bool(master['pki_external']): if not master.has_key('pki_external_step_two') or\ not len(master['pki_external_step_two']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_external_step_two", master['pki_deployment_cfg'], @@ -691,14 +692,14 @@ class configuration_file: if not config.str2bool(master['pki_step_two']): if not master.has_key('pki_external_csr_path') or\ not len(master['pki_external_csr_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_external_csr_path", master['pki_deployment_cfg'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) elif not os.path.isfile(master['pki_external_csr_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, master['pki_external_csr_path'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -706,7 +707,7 @@ class configuration_file: else: if not master.has_key('pki_external_ca_cert_chain_path') or\ not len(master['pki_external_ca_cert_chain_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_external_ca_cert_chain_path", master['pki_deployment_cfg'], @@ -714,14 +715,14 @@ class configuration_file: sys.exit(1) elif not os.path.isfile( master['pki_external_ca_cert_chain_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, master['pki_external_ca_cert_chain_path'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) if not master.has_key('pki_external_ca_cert_path') or\ not len(master['pki_external_ca_cert_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2, "pki_external_ca_cert_path", master['pki_deployment_cfg'], @@ -729,7 +730,7 @@ class configuration_file: sys.exit(1) elif not os.path.isfile( master['pki_external_ca_cert_path']): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, master['pki_external_ca_cert_path'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -778,7 +779,7 @@ class configuration_file: # remove from list of ports to set ports.remove(port) else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_INVALID_SELINUX_CONTEXT_FOR_PORT, port, context, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -791,7 +792,7 @@ class configuration_file: if master['pki_deployment_executable'] == 'pkidestroy': if master['pki_deployed_instance_name'] !=\ master['pki_instance_id']: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_COMMAND_LINE_PARAMETER_MISMATCH_2, master['pki_deployed_instance_name'], master['pki_instance_id'], @@ -806,7 +807,7 @@ class configuration_file: # def remove_filter_section_from_web_xml(self, # web_xml_source, # web_xml_target): -# config.pki_log.info(log.PKIHELPER_REMOVE_FILTER_SECTION_1, +# pkilogging.pki_log.info(log.PKIHELPER_REMOVE_FILTER_SECTION_1, # master['pki_target_subsystem_web_xml'], # extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # begin_filters_section = False @@ -845,11 +846,11 @@ class instance: path = master['pki_instance_path'] + "/" + subsystem.lower() if os.path.exists(path) and os.path.isdir(path): rv = rv + 1 - config.pki_log.debug(log.PKIHELPER_APACHE_INSTANCE_SUBSYSTEMS_2, + pkilogging.pki_log.debug(log.PKIHELPER_APACHE_INSTANCE_SUBSYSTEMS_2, master['pki_instance_path'], rv, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return rv @@ -871,12 +872,12 @@ class instance: os.path.join(master['pki_instance_type_registry_path'], instance)): rv = rv + 1 - config.pki_log.debug(log.PKIHELPER_APACHE_INSTANCES_2, + pkilogging.pki_log.debug(log.PKIHELPER_APACHE_INSTANCES_2, master['pki_instance_type_registry_path'], rv, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return rv @@ -900,11 +901,11 @@ class instance: not os.path.islink(os.path.join(dir,name)): if name.upper() in PKIConfig.PKI_SUBSYSTEMS: rv = rv + 1 - config.pki_log.debug(log.PKIHELPER_PKI_INSTANCE_SUBSYSTEMS_2, + pkilogging.pki_log.debug(log.PKIHELPER_PKI_INSTANCE_SUBSYSTEMS_2, master['pki_instance_path'], rv, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return rv @@ -918,11 +919,11 @@ class instance: path = master['pki_instance_path'] + "/" + subsystem.lower() if os.path.exists(path) and os.path.isdir(path): rv = rv + 1 - config.pki_log.debug(log.PKIHELPER_TOMCAT_INSTANCE_SUBSYSTEMS_2, + pkilogging.pki_log.debug(log.PKIHELPER_TOMCAT_INSTANCE_SUBSYSTEMS_2, master['pki_instance_path'], rv, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return rv @@ -944,12 +945,12 @@ class instance: os.path.join(master['pki_instance_type_registry_path'], instance)): rv = rv + 1 - config.pki_log.debug(log.PKIHELPER_TOMCAT_INSTANCES_2, + pkilogging.pki_log.debug(log.PKIHELPER_TOMCAT_INSTANCES_2, master['pki_instance_type_registry_path'], rv, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return rv @@ -957,26 +958,26 @@ class instance: def verify_subsystem_exists(self): try: if not os.path.exists(master['pki_subsystem_path']): - config.pki_log.error(log.PKI_SUBSYSTEM_DOES_NOT_EXIST_2, + pkilogging.pki_log.error(log.PKI_SUBSYSTEM_DOES_NOT_EXIST_2, master['pki_subsystem'], master['pki_instance_id'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) def verify_subsystem_does_not_exist(self): try: if os.path.exists(master['pki_subsystem_path']): - config.pki_log.error(log.PKI_SUBSYSTEM_ALREADY_EXISTS_2, + pkilogging.pki_log.error(log.PKI_SUBSYSTEM_ALREADY_EXISTS_2, master['pki_subsystem'], master['pki_instance_id'], extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -989,11 +990,11 @@ class directory: try: if not os.path.exists(name): # mkdir -p - config.pki_log.info(log.PKIHELPER_MKDIR_1, name, + pkilogging.pki_log.info(log.PKIHELPER_MKDIR_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) os.makedirs(name) # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(name, perms) # chown : @@ -1001,7 +1002,7 @@ class directory: uid = identity.get_uid() if gid == None: gid = identity.get_gid() - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(name, uid, gid) @@ -1017,7 +1018,7 @@ class directory: record.acls = acls manifest.database.append(record) elif not os.path.isdir(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_ALREADY_EXISTS_NOT_A_DIRECTORY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: @@ -1026,7 +1027,7 @@ class directory: if exc.errno == errno.EEXIST: pass else: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1038,18 +1039,18 @@ class directory: try: if os.path.exists(name): if not os.path.isdir(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_ALREADY_EXISTS_NOT_A_DIRECTORY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) # Always re-process each directory whether it needs it or not if not silent: - config.pki_log.info(log.PKIHELPER_MODIFY_DIR_1, name, + pkilogging.pki_log.info(log.PKIHELPER_MODIFY_DIR_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # chmod if not silent: - config.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(name, perms) # chown : @@ -1058,7 +1059,7 @@ class directory: if gid == None: gid = identity.get_gid() if not silent: - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(name, uid, gid) @@ -1075,13 +1076,13 @@ class directory: record.acls = acls manifest.database.append(record) else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1091,22 +1092,22 @@ class directory: try: if not os.path.exists(name) or not os.path.isdir(name): # Simply issue a warning and continue - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) else: if recursive_flag == True: # rm -rf - config.pki_log.info(log.PKIHELPER_RM_RF_1, name, + pkilogging.pki_log.info(log.PKIHELPER_RM_RF_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) shutil.rmtree(name) else: # rmdir - config.pki_log.info(log.PKIHELPER_RMDIR_1, name, + pkilogging.pki_log.info(log.PKIHELPER_RMDIR_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) os.rmdir(name) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1119,22 +1120,22 @@ class directory: else: return True except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) def is_empty(self, name): try: if not os.listdir(name): - config.pki_log.debug(log.PKIHELPER_DIRECTORY_IS_EMPTY_1, + pkilogging.pki_log.debug(log.PKIHELPER_DIRECTORY_IS_EMPTY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) return True else: - config.pki_log.debug(log.PKIHELPER_DIRECTORY_IS_NOT_EMPTY_1, + pkilogging.pki_log.debug(log.PKIHELPER_DIRECTORY_IS_NOT_EMPTY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) return False except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -1147,12 +1148,12 @@ class directory: recursive_flag=True, critical_failure=True): try: if not os.path.exists(name) or not os.path.isdir(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) else: - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_SET_MODE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if uid == None: @@ -1165,16 +1166,16 @@ class directory: entity = os.path.join(root, name) if not os.path.islink(entity): file = entity - config.pki_log.debug( + pkilogging.pki_log.debug( log.PKIHELPER_IS_A_FILE_1, file, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, file_perms, file, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(file, file_perms) # chown : - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, file, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(file, uid, gid) @@ -1191,7 +1192,7 @@ class directory: manifest.database.append(record) else: symlink = entity - config.pki_log.debug( + pkilogging.pki_log.debug( log.PKIHELPER_IS_A_SYMLINK_1, symlink, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) # REMINDER: Due to POSIX compliance, 'lchmod' @@ -1200,7 +1201,7 @@ class directory: # run directly against symbolic # links! # chown -h : - config.pki_log.debug(log.PKIHELPER_CHOWN_H_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_H_3, uid, gid, symlink, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.lchown(symlink, uid, gid) @@ -1217,16 +1218,16 @@ class directory: manifest.database.append(record) for name in dirs: dir = os.path.join(root, name) - config.pki_log.debug( + pkilogging.pki_log.debug( log.PKIHELPER_IS_A_DIRECTORY_1, dir, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, dir_perms, dir, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(dir, dir_perms) # chown : - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, dir, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(dir, uid, gid) @@ -1242,17 +1243,17 @@ class directory: record.acls = dir_acls manifest.database.append(record) else: - config.pki_log.debug( + pkilogging.pki_log.debug( log.PKIHELPER_IS_A_DIRECTORY_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) name = os.path.join(root, name) # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, dir_perms, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(name, dir_perms) # chown : - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(name, uid, gid) @@ -1268,7 +1269,7 @@ class directory: record.acls = dir_acls manifest.database.append(record) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1281,20 +1282,20 @@ class directory: recursive_flag=True, overwrite_flag=False, critical_failure=True): try: if not os.path.exists(old_name) or not os.path.isdir(old_name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, old_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) else: if os.path.exists(new_name): if not overwrite_flag: - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_ALREADY_EXISTS_1, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) if recursive_flag == True: # cp -rp - config.pki_log.info(log.PKIHELPER_CP_RP_2, + pkilogging.pki_log.info(log.PKIHELPER_CP_RP_2, old_name, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Due to a limitation in the 'shutil.copytree()' @@ -1307,7 +1308,7 @@ class directory: pki_copytree(old_name, new_name) else: # cp -p - config.pki_log.info(log.PKIHELPER_CP_P_2, + pkilogging.pki_log.info(log.PKIHELPER_CP_P_2, old_name, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) shutil.copy2(old_name, new_name) @@ -1322,12 +1323,12 @@ class directory: dir_acls, file_acls, symlink_acls, recursive_flag, critical_failure) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except shutil.Error as exc: - config.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1342,11 +1343,11 @@ class file: try: if not os.path.exists(name): # touch - config.pki_log.info(log.PKIHELPER_TOUCH_1, name, + pkilogging.pki_log.info(log.PKIHELPER_TOUCH_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) open(name, "w").close() # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(name, perms) # chown : @@ -1354,7 +1355,7 @@ class file: uid = identity.get_uid() if gid == None: gid = identity.get_gid() - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(name, uid, gid) @@ -1370,7 +1371,7 @@ class file: record.acls = acls manifest.database.append(record) elif not os.path.isfile(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: @@ -1379,7 +1380,7 @@ class file: if exc.errno == errno.EEXIST: pass else: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1391,18 +1392,18 @@ class file: try: if os.path.exists(name): if not os.path.isfile(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) # Always re-process each file whether it needs it or not if not silent: - config.pki_log.info(log.PKIHELPER_MODIFY_FILE_1, name, + pkilogging.pki_log.info(log.PKIHELPER_MODIFY_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # chmod if not silent: - config.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(name, perms) # chown : @@ -1411,7 +1412,7 @@ class file: if gid == None: gid = identity.get_gid() if not silent: - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(name, uid, gid) @@ -1428,13 +1429,13 @@ class file: record.acls = acls manifest.database.append(record) else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1444,16 +1445,16 @@ class file: try: if not os.path.exists(name) or not os.path.isfile(name): # Simply issue a warning and continue - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) else: # rm -f - config.pki_log.info(log.PKIHELPER_RM_F_1, name, + pkilogging.pki_log.info(log.PKIHELPER_RM_F_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) os.remove(name) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1466,7 +1467,7 @@ class file: else: return True except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -1475,19 +1476,19 @@ class file: overwrite_flag=False, critical_failure=True): try: if not os.path.exists(old_name) or not os.path.isfile(old_name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, old_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) else: if os.path.exists(new_name): if not overwrite_flag: - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_1, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) # cp -p - config.pki_log.info(log.PKIHELPER_CP_P_2, + pkilogging.pki_log.info(log.PKIHELPER_CP_P_2, old_name, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) shutil.copy2(old_name, new_name) @@ -1496,12 +1497,12 @@ class file: if gid == None: gid = identity.get_gid() # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(new_name, perms) # chown : - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(new_name, uid, gid) @@ -1517,12 +1518,12 @@ class file: record.acls = acls manifest.database.append(record) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except shutil.Error as exc: - config.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1534,18 +1535,18 @@ class file: acls=None, critical_failure=True): try: if not os.path.exists(name) or not os.path.isfile(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) # applying in-place slot substitutions on - config.pki_log.info(log.PKIHELPER_APPLY_SLOT_SUBSTITUTION_1, + pkilogging.pki_log.info(log.PKIHELPER_APPLY_SLOT_SUBSTITUTION_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) for line in fileinput.FileInput(name, inplace=1): for slot in slots: if slot != '__name__' and slots[slot] in line: - config.pki_log.debug( + pkilogging.pki_log.debug( log.PKIHELPER_SLOT_SUBSTITUTION_2, slots[slot], master[slot], extra=PKIConfig.PKI_INDENTATION_LEVEL_3) @@ -1556,12 +1557,12 @@ class file: if gid == None: gid = identity.get_gid() # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(name, perms) # chown : - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(name, uid, gid) @@ -1577,12 +1578,12 @@ class file: record.acls = acls manifest.database.append(record) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except shutil.Error as exc: - config.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1595,26 +1596,26 @@ class file: critical_failure=True): try: if not os.path.exists(old_name) or not os.path.isfile(old_name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, old_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) else: if os.path.exists(new_name): if not overwrite_flag: - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_1, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) # copy to with slot substitutions - config.pki_log.info(log.PKIHELPER_COPY_WITH_SLOT_SUBSTITUTION_2, + pkilogging.pki_log.info(log.PKIHELPER_COPY_WITH_SLOT_SUBSTITUTION_2, old_name, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) FILE = open(new_name, "w") for line in fileinput.FileInput(old_name): for slot in slots: if slot != '__name__' and slots[slot] in line: - config.pki_log.debug( + pkilogging.pki_log.debug( log.PKIHELPER_SLOT_SUBSTITUTION_2, slots[slot], master[slot], extra=PKIConfig.PKI_INDENTATION_LEVEL_3) @@ -1626,12 +1627,12 @@ class file: if gid == None: gid = identity.get_gid() # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(new_name, perms) # chown : - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, new_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(new_name, uid, gid) @@ -1647,12 +1648,12 @@ class file: record.acls = acls manifest.database.append(record) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except shutil.Error as exc: - config.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SHUTIL_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1665,7 +1666,7 @@ class file: if not os.path.exists(name): # generating noise file called and # filling it with random bytes - config.pki_log.info(log.PKIHELPER_NOISE_FILE_2, name, bytes, + pkilogging.pki_log.info(log.PKIHELPER_NOISE_FILE_2, name, bytes, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) open(name, "w").close() FILE = open(name, "w") @@ -1674,7 +1675,7 @@ class file: FILE.write(noise) FILE.close() # chmod - config.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, + pkilogging.pki_log.debug(log.PKIHELPER_CHMOD_2, perms, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chmod(name, perms) # chown : @@ -1682,7 +1683,7 @@ class file: uid = identity.get_uid() if gid == None: gid = identity.get_gid() - config.pki_log.debug(log.PKIHELPER_CHOWN_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_3, uid, gid, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.chown(name, uid, gid) @@ -1698,7 +1699,7 @@ class file: record.acls = acls manifest.database.append(record) elif not os.path.isfile(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_ALREADY_EXISTS_NOT_A_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: @@ -1707,7 +1708,7 @@ class file: if exc.errno == errno.EEXIST: pass else: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1721,13 +1722,13 @@ class symlink: try: if not os.path.exists(link): if not os.path.exists(name): - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_DANGLING_SYMLINK_2, link, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if not allow_dangling_symlink: sys.exit(1) # ln -s - config.pki_log.info(log.PKIHELPER_LINK_S_2, name, link, + pkilogging.pki_log.info(log.PKIHELPER_LINK_S_2, name, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) os.symlink(name, link) # REMINDER: Due to POSIX compliance, 'lchmod' is NEVER @@ -1738,7 +1739,7 @@ class symlink: uid = identity.get_uid() if gid == None: gid = identity.get_gid() - config.pki_log.debug(log.PKIHELPER_CHOWN_H_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_H_3, uid, gid, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.lchown(link, uid, gid) @@ -1755,7 +1756,7 @@ class symlink: record.acls = acls manifest.database.append(record) elif not os.path.islink(link): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_SYMLINK_ALREADY_EXISTS_NOT_A_SYMLINK_1, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: @@ -1764,7 +1765,7 @@ class symlink: if exc.errno == errno.EEXIST: pass else: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1775,14 +1776,14 @@ class symlink: try: if os.path.exists(link): if not os.path.islink(link): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_SYMLINK_ALREADY_EXISTS_NOT_A_SYMLINK_1, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) # Always re-process each link whether it needs it or not if not silent: - config.pki_log.info(log.PKIHELPER_MODIFY_SYMLINK_1, link, + pkilogging.pki_log.info(log.PKIHELPER_MODIFY_SYMLINK_1, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # REMINDER: Due to POSIX compliance, 'lchmod' is NEVER # implemented on Linux systems since 'chmod' @@ -1793,7 +1794,7 @@ class symlink: if gid == None: gid = identity.get_gid() if not silent: - config.pki_log.debug(log.PKIHELPER_CHOWN_H_3, + pkilogging.pki_log.debug(log.PKIHELPER_CHOWN_H_3, uid, gid, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_3) os.lchown(link, uid, gid) @@ -1811,13 +1812,13 @@ class symlink: record.acls = acls manifest.database.append(record) else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_SYMLINK_MISSING_OR_NOT_A_SYMLINK_1, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1827,16 +1828,16 @@ class symlink: try: if not os.path.exists(link) or not os.path.islink(link): # Simply issue a warning and continue - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKI_SYMLINK_MISSING_OR_NOT_A_SYMLINK_1, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) else: # rm -f - config.pki_log.info(log.PKIHELPER_RM_F_1, link, + pkilogging.pki_log.info(log.PKIHELPER_RM_F_1, link, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) os.remove(link) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1849,7 +1850,7 @@ class symlink: else: return True except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -1860,42 +1861,42 @@ class war: try: if os.path.exists(name) and os.path.isfile(name): if not zipfile.is_zipfile(name): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_NOT_A_WAR_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) if not os.path.exists(path) or not os.path.isdir(path): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) # jar -xf -C - config.pki_log.info(log.PKIHELPER_JAR_XF_C_2, name, path, + pkilogging.pki_log.info(log.PKIHELPER_JAR_XF_C_2, name, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Open war file war = zipfile.ZipFile(name, 'r') # Extract contents of war file to path war.extractall(path) else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except zipfile.BadZipfile as exc: - config.pki_log.error(log.PKI_BADZIPFILE_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_BADZIPFILE_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except zipfile.LargeZipFile as exc: - config.pki_log.error(log.PKI_LARGEZIPFILE_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_LARGEZIPFILE_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1909,7 +1910,7 @@ class password: try: if os.path.exists(path): if overwrite_flag: - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_PASSWORD_CONF_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # overwrite the existing 'password.conf' file @@ -1925,7 +1926,7 @@ class password: "=" + str(pin)) fd.closed else: - config.pki_log.info(log.PKIHELPER_PASSWORD_CONF_1, path, + pkilogging.pki_log.info(log.PKIHELPER_PASSWORD_CONF_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # create a new 'password.conf' file with open(path, "wt") as fd: @@ -1940,7 +1941,7 @@ class password: "=" + str(pin)) fd.closed except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1951,7 +1952,7 @@ class password: try: if os.path.exists(path): if overwrite_flag: - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_PASSWORD_CONF_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # overwrite the existing 'pkcs12_password.conf' file @@ -1959,14 +1960,14 @@ class password: fd.write(sensitive['pki_client_pkcs12_password']) fd.closed else: - config.pki_log.info(log.PKIHELPER_PASSWORD_CONF_1, path, + pkilogging.pki_log.info(log.PKIHELPER_PASSWORD_CONF_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # create a new 'pkcs12_password.conf' file with open(path, "wt") as fd: fd.write(sensitive['pki_client_pkcs12_password']) fd.closed except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -1986,7 +1987,7 @@ class certutil: if path: command = command + " " + "-d" + " " + path else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_PATH, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -1995,7 +1996,7 @@ class certutil: if prefix != None: command = command + " " + "-P" + " " + prefix if not os.path.exists(path): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2003,7 +2004,7 @@ class certutil: os.path.exists(pki_key_database) or\ os.path.exists(pki_secmod_database): # Simply notify user that the security databases exist - config.pki_log.info( + pkilogging.pki_log.info( log.PKI_SECURITY_DATABASES_ALREADY_EXIST_3, pki_cert_database, pki_key_database, @@ -2013,25 +2014,25 @@ class certutil: if password_file != None: if not os.path.exists(password_file) or\ not os.path.isfile(password_file): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, password_file, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) # Display this "certutil" command - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_CREATE_SECURITY_DATABASES_1, command, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Execute this "certutil" command subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -2049,7 +2050,7 @@ class certutil: if path: command = command + " " + "-d" + " " + path else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_PATH, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2057,7 +2058,7 @@ class certutil: if token: command = command + " " + "-h" + " " + "'" + token + "'" else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_TOKEN, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2065,7 +2066,7 @@ class certutil: if nickname: command = command + " " + "-n" + " " + "'" + nickname + "'" else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_NICKNAME, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2076,7 +2077,7 @@ class certutil: if silent != False: command = command + " > /dev/null 2>&1" if not os.path.exists(path): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2084,7 +2085,7 @@ class certutil: not os.path.exists(pki_key_database) or\ not os.path.exists(pki_secmod_database): # NSS security databases MUST exist! - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_SECURITY_DATABASES_DO_NOT_EXIST_3, pki_cert_database, pki_key_database, @@ -2094,7 +2095,7 @@ class certutil: if password_file != None: if not os.path.exists(password_file) or\ not os.path.isfile(password_file): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, password_file, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -2104,7 +2105,7 @@ class certutil: except subprocess.CalledProcessError as exc: return False except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -2125,7 +2126,7 @@ class certutil: if path: command = command + " " + "-d" + " " + path else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_PATH, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2133,7 +2134,7 @@ class certutil: if token: command = command + " " + "-h" + " " + "'" + token + "'" else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_TOKEN, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2141,7 +2142,7 @@ class certutil: if nickname: command = command + " " + "-n" + " " + "'" + nickname + "'" else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_NICKNAME, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2149,7 +2150,7 @@ class certutil: if subject: command = command + " " + "-s" + " " + "'" + subject + "'" else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_SUBJECT, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2157,7 +2158,7 @@ class certutil: if serial_number != None: command = command + " " + "-m" + " " + str(serial_number) else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_SERIAL_NUMBER, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2165,7 +2166,7 @@ class certutil: if validity_period != None: command = command + " " + "-v" + " " + str(validity_period) else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_VALIDITY_PERIOD, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2174,7 +2175,7 @@ class certutil: command = command + " " + "-c" + " " +\ "'" + issuer_name + "'" else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_ISSUER_NAME, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2182,7 +2183,7 @@ class certutil: if trustargs: command = command + " " + "-t" + " " + "'" + trustargs + "'" else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_TRUSTARGS, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2190,7 +2191,7 @@ class certutil: if noise_file: command = command + " " + "-z" + " " + noise_file else: - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_CERTUTIL_MISSING_NOISE_FILE, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2202,11 +2203,11 @@ class certutil: # ALWAYS mask the command-line output of this command command = command + " " + "> /dev/null 2>&1" # Display this "certutil" command - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_CERTUTIL_SELF_SIGNED_CERTIFICATE_1, command, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if not os.path.exists(path): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, path, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) @@ -2214,7 +2215,7 @@ class certutil: not os.path.exists(pki_key_database) or\ not os.path.exists(pki_secmod_database): # NSS security databases MUST exist! - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_SECURITY_DATABASES_DO_NOT_EXIST_3, pki_cert_database, pki_key_database, @@ -2222,7 +2223,7 @@ class certutil: extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) if not os.path.exists(noise_file): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, noise_file, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -2230,7 +2231,7 @@ class certutil: if password_file != None: if not os.path.exists(password_file) or\ not os.path.isfile(password_file): - config.pki_log.error( + pkilogging.pki_log.error( log.PKI_FILE_MISSING_OR_NOT_A_FILE_1, password_file, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -2238,12 +2239,12 @@ class certutil: # Execute this "certutil" command subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -2277,12 +2278,12 @@ class security_domain: subsystemnick_param = typeval.lower() + ".cert.subsystem.nickname" subsystemnick = cs_cfg.get(subsystemnick_param) if subsystemnick is None: - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_SECURITY_DOMAIN_UPDATE_FAILURE_2, typeval, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_UNDEFINED_SUBSYSTEM_NICKNAME, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: @@ -2302,12 +2303,12 @@ class security_domain: seceeport is None or\ secagentport is None or\ secadminport is None: - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_SECURITY_DOMAIN_UPDATE_FAILURE_2, typeval, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_SECURITY_DOMAIN_UNDEFINED, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: @@ -2317,7 +2318,7 @@ class security_domain: if secselect != "new": # This is not a domain master, so we need to update the master - config.pki_log.info(log.PKIHELPER_SECURITY_DOMAIN_CONTACT_1, + pkilogging.pki_log.info(log.PKIHELPER_SECURITY_DOMAIN_CONTACT_1, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) listval = typeval.lower() + "List" @@ -2345,12 +2346,12 @@ class security_domain: if token_pwd is None or token_pwd == '': # 'pkiremove' prompts with # "What is the password for this token?" - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_SECURITY_DOMAIN_UPDATE_FAILURE_2, typeval, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) - config.pki_log.error(log.PKIHELPER_PASSWORD_NOT_FOUND_1, + pkilogging.pki_log.error(log.PKIHELPER_PASSWORD_NOT_FOUND_1, token_name, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: @@ -2384,13 +2385,13 @@ class security_domain: output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) - config.pki_log.debug(log.PKIHELPER_SSLGET_OUTPUT_1, + pkilogging.pki_log.debug(log.PKIHELPER_SSLGET_OUTPUT_1, output, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Search the output for Status status = re.findall("\(.*?)\<\/Status\>", output) if not status: - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_SECURITY_DOMAIN_UNREACHABLE_1, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) @@ -2400,12 +2401,12 @@ class security_domain: error = re.findall("\(.*?)\<\/Error\>", output) if not error: error = "" - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_SECURITY_DOMAIN_UNREGISTERED_2, typeval, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) - config.pki_log.error( + pkilogging.pki_log.error( log.PKIHELPER_SECURITY_DOMAIN_UPDATE_FAILURE_3, typeval, secname, @@ -2414,22 +2415,22 @@ class security_domain: if critical_failure == True: sys.exit(-1) else: - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_SECURITY_DOMAIN_UPDATE_SUCCESS_2, typeval, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) except subprocess.CalledProcessError as exc: - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_SECURITY_DOMAIN_UPDATE_FAILURE_2, typeval, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) - config.pki_log.warning( + pkilogging.pki_log.warning( log.PKIHELPER_SECURITY_DOMAIN_UNREACHABLE_1, secname, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(-1) @@ -2452,13 +2453,13 @@ class systemd: "pki-tomcatd" + "@" +\ master['pki_instance_id'] + "." + "service" # Display this "systemd" execution managment command - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_SYSTEMD_COMMAND_1, command, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Execute this "systemd" execution management command subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -2478,13 +2479,13 @@ class systemd: "pki-tomcatd" + "@" +\ master['pki_instance_id'] + "." + "service" # Display this "systemd" execution managment command - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_SYSTEMD_COMMAND_1, command, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Execute this "systemd" execution management command subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -2504,13 +2505,13 @@ class systemd: "pki-tomcatd" + "@" +\ master['pki_instance_id'] + "." + "service" # Display this "systemd" execution managment command - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_SYSTEMD_COMMAND_1, command, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Execute this "systemd" execution management command subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) @@ -2542,14 +2543,14 @@ class jython: property + " " + scriptlet + " " + "\"" + data + "\"" +\ " " + "\"" + sensitive_data + "\"" # Display this "jython" command - config.pki_log.info( + pkilogging.pki_log.info( log.PKIHELPER_INVOKE_JYTHON_3, ld_library_path, property, scriptlet, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) # Invoke this "jython" command subprocess.call(command, shell=True) except subprocess.CalledProcessError as exc: - config.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, + pkilogging.pki_log.error(log.PKI_SUBPROCESS_ERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) if critical_failure == True: sys.exit(1) diff --git a/base/deploy/src/scriptlets/pkilogging.py b/base/deploy/src/scriptlets/pkilogging.py index 9b22ae39c..98bfebbed 100644 --- a/base/deploy/src/scriptlets/pkilogging.py +++ b/base/deploy/src/scriptlets/pkilogging.py @@ -24,6 +24,15 @@ import logging import os +# PKI Deployment Logger Variables +pki_log = None +pki_log_dir = None +pki_log_name = None +pki_log_level = None +pki_console_log_level = None +pki_jython_log_level = None + + # PKI Deployment Logging Functions def enable_pki_logger(log_dir, log_name, log_level, console_log_level, logger): if not os.path.isdir(log_dir): diff --git a/base/deploy/src/scriptlets/pkimanifest.py b/base/deploy/src/scriptlets/pkimanifest.py index 6e2b9c367..b40bf86cc 100644 --- a/base/deploy/src/scriptlets/pkimanifest.py +++ b/base/deploy/src/scriptlets/pkimanifest.py @@ -28,6 +28,7 @@ import sys # PKI Deployment Imports import pkiconfig as config from pkiconfig import PKIConfig +import pkilogging import pkimessages as log @@ -80,7 +81,7 @@ class file: c.writerow(tuple(record)) fd.close() except IOError as exc: - config.pki_log.error(log.PKI_IOERROR_1, exc, + pkilogging.pki_log.error(log.PKI_IOERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) sys.exit(1) @@ -92,7 +93,7 @@ class file: print tuple(row) fd.close() except IOError as exc: - config.pki_log.error(log.PKI_IOERROR_1, exc, + pkilogging.pki_log.error(log.PKI_IOERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) sys.exit(1) diff --git a/base/deploy/src/scriptlets/pkiparser.py b/base/deploy/src/scriptlets/pkiparser.py index 971c64040..9ac4be2ae 100644 --- a/base/deploy/src/scriptlets/pkiparser.py +++ b/base/deploy/src/scriptlets/pkiparser.py @@ -33,6 +33,7 @@ import time # PKI Deployment Imports import pkiconfig as config from pkiconfig import PKIConfig +import pkilogging import pkimessages as log @@ -111,17 +112,17 @@ class PKIConfigParser: # Process 'Optional' command-line options # '-v' if args.pki_verbosity == 1: - config.pki_jython_log_level = PKIConfig.PKI_JYTHON_INFO_LOG_LEVEL - config.pki_console_log_level = logging.INFO - config.pki_log_level = logging.INFO + pkilogging.pki_jython_log_level = PKIConfig.PKI_JYTHON_INFO_LOG_LEVEL + pkilogging.pki_console_log_level = logging.INFO + pkilogging.pki_log_level = logging.INFO elif args.pki_verbosity == 2: - config.pki_jython_log_level = PKIConfig.PKI_JYTHON_INFO_LOG_LEVEL - config.pki_console_log_level = logging.INFO - config.pki_log_level = logging.DEBUG + pkilogging.pki_jython_log_level = PKIConfig.PKI_JYTHON_INFO_LOG_LEVEL + pkilogging.pki_console_log_level = logging.INFO + pkilogging.pki_log_level = logging.DEBUG elif args.pki_verbosity == 3: - config.pki_jython_log_level = PKIConfig.PKI_JYTHON_DEBUG_LOG_LEVEL - config.pki_console_log_level = logging.DEBUG - config.pki_log_level = logging.DEBUG + pkilogging.pki_jython_log_level = PKIConfig.PKI_JYTHON_DEBUG_LOG_LEVEL + pkilogging.pki_console_log_level = logging.DEBUG + pkilogging.pki_log_level = logging.DEBUG elif args.pki_verbosity > 3: print "ERROR: " + log.PKI_VERBOSITY_LEVELS_MESSAGE print @@ -129,9 +130,9 @@ class PKIConfigParser: parser.exit(-1); else: # Set default log levels - config.pki_jython_log_level = PKIConfig.PKI_JYTHON_WARNING_LOG_LEVEL - config.pki_console_log_level = logging.WARNING - config.pki_log_level = logging.INFO + pkilogging.pki_jython_log_level = PKIConfig.PKI_JYTHON_WARNING_LOG_LEVEL + pkilogging.pki_console_log_level = logging.WARNING + pkilogging.pki_log_level = logging.INFO # Process 'Test' command-line options # '-p' if not args.pki_root_prefix is None: @@ -262,7 +263,7 @@ class PKIConfigParser: config.pki_master_dict['pki_dns_domainname'] =\ config.pki_dns_domainname config.pki_master_dict['pki_jython_log_level'] =\ - config.pki_jython_log_level + pkilogging.pki_jython_log_level config.pki_master_dict['pki_deployment_cfg'] = config.pkideployment_cfg config.pki_master_dict['pki_deployed_instance_name'] =\ config.pki_deployed_instance_name @@ -2342,11 +2343,11 @@ class PKIConfigParser: "pki-tomcatd" + "@" +\ config.pki_master_dict['pki_instance_id'] + "." + "service" except OSError as exc: - config.pki_log.error(log.PKI_OSERROR_1, exc, + pkilogging.pki_log.error(log.PKI_OSERROR_1, exc, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) except KeyError as err: - config.pki_log.error(log.PKIHELPER_DICTIONARY_MASTER_MISSING_KEY_1, + pkilogging.pki_log.error(log.PKIHELPER_DICTIONARY_MASTER_MISSING_KEY_1, err, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) sys.exit(1) return diff --git a/base/deploy/src/scriptlets/security_databases.py b/base/deploy/src/scriptlets/security_databases.py index 1a437e2da..5e4cb718b 100644 --- a/base/deploy/src/scriptlets/security_databases.py +++ b/base/deploy/src/scriptlets/security_databases.py @@ -25,6 +25,7 @@ from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master from pkiconfig import pki_sensitive_dict as sensitive import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet @@ -35,10 +36,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_SECURITY_DATABASES_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_SECURITY_DATABASES_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.SECURITY_DATABASES_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SECURITY_DATABASES_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) util.password.create_password_conf( master['pki_shared_password_conf'], @@ -99,7 +100,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.SECURITY_DATABASES_DESTROY_1, __name__, + pkilogging.pki_log.info(log.SECURITY_DATABASES_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) if master['pki_subsystem'] in PKIConfig.PKI_APACHE_SUBSYSTEMS and\ util.instance.apache_instance_subsystems() == 0: diff --git a/base/deploy/src/scriptlets/selinux_setup.py b/base/deploy/src/scriptlets/selinux_setup.py index be976cd18..130593953 100644 --- a/base/deploy/src/scriptlets/selinux_setup.py +++ b/base/deploy/src/scriptlets/selinux_setup.py @@ -25,6 +25,7 @@ from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master from pkiconfig import pki_selinux_config_ports as ports import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet import seobject @@ -42,10 +43,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_SELINUX_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_SELINUX_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.SELINUX_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SELINUX_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # check first if any transactions are required @@ -67,25 +68,25 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): fcon = seobject.fcontextRecords() - config.pki_log.info("adding selinux fcontext \"%s\"", + pkilogging.pki_log.info("adding selinux fcontext \"%s\"", master['pki_instance_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.add(master['pki_instance_path'] + self.suffix, PKIConfig.PKI_INSTANCE_SELINUX_CONTEXT, "", "s0", "") - config.pki_log.info("adding selinux fcontext \"%s\"", + pkilogging.pki_log.info("adding selinux fcontext \"%s\"", master['pki_instance_log_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.add(master['pki_instance_log_path'] + self.suffix, PKIConfig.PKI_LOG_SELINUX_CONTEXT, "", "s0", "") - config.pki_log.info("adding selinux fcontext \"%s\"", + pkilogging.pki_log.info("adding selinux fcontext \"%s\"", master['pki_instance_configuration_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.add(master['pki_instance_configuration_path'] + self.suffix, PKIConfig.PKI_CFG_SELINUX_CONTEXT, "", "s0", "") - config.pki_log.info("adding selinux fcontext \"%s\"", + pkilogging.pki_log.info("adding selinux fcontext \"%s\"", master['pki_database_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.add(master['pki_database_path'] + self.suffix, @@ -93,7 +94,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): portRecords = seobject.portRecords() for port in ports: - config.pki_log.info("adding selinux port %s", port, + pkilogging.pki_log.info("adding selinux port %s", port, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) portRecords.add(port, "tcp", "s0", PKIConfig.PKI_PORT_SELINUX_CONTEXT) @@ -103,7 +104,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.SELINUX_DESTROY_1, __name__, + pkilogging.pki_log.info(log.SELINUX_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # check first if any transactions are required @@ -125,30 +126,30 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): fcon = seobject.fcontextRecords() - config.pki_log.info("deleting selinux fcontext \"%s\"", + pkilogging.pki_log.info("deleting selinux fcontext \"%s\"", master['pki_instance_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.delete(master['pki_instance_path'] + self.suffix , "") - config.pki_log.info("deleting selinux fcontext \"%s\"", + pkilogging.pki_log.info("deleting selinux fcontext \"%s\"", master['pki_instance_log_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.delete(master['pki_instance_log_path'] + self.suffix, "") - config.pki_log.info("deleting selinux fcontext \"%s\"", + pkilogging.pki_log.info("deleting selinux fcontext \"%s\"", master['pki_instance_configuration_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.delete(master['pki_instance_configuration_path'] + \ self.suffix, "") - config.pki_log.info("deleting selinux fcontext \"%s\"", + pkilogging.pki_log.info("deleting selinux fcontext \"%s\"", master['pki_database_path'] + self.suffix, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) fcon.delete(master['pki_database_path'] + self.suffix , "") portRecords = seobject.portRecords() for port in ports: - config.pki_log.info("deleting selinux port %s", port, + pkilogging.pki_log.info("deleting selinux port %s", port, extra=PKIConfig.PKI_INDENTATION_LEVEL_2) portRecords.delete(port, "tcp") diff --git a/base/deploy/src/scriptlets/slot_substitution.py b/base/deploy/src/scriptlets/slot_substitution.py index d80ccf0e8..7e3971ab1 100644 --- a/base/deploy/src/scriptlets/slot_substitution.py +++ b/base/deploy/src/scriptlets/slot_substitution.py @@ -25,6 +25,7 @@ from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master from pkiconfig import pki_slots_dict as slots import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet @@ -35,10 +36,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_SLOT_ASSIGNMENT_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_SLOT_ASSIGNMENT_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.SLOT_ASSIGNMENT_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SLOT_ASSIGNMENT_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) util.file.copy_with_slot_substitution(master['pki_source_cs_cfg'], master['pki_target_cs_cfg']) @@ -94,8 +95,8 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.SLOT_ASSIGNMENT_DESTROY_1, __name__, + pkilogging.pki_log.info(log.SLOT_ASSIGNMENT_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) - config.pki_log.info("NOTHING NEEDS TO BE IMPLEMENTED", + pkilogging.pki_log.info("NOTHING NEEDS TO BE IMPLEMENTED", extra=PKIConfig.PKI_INDENTATION_LEVEL_2) return self.rv diff --git a/base/deploy/src/scriptlets/subsystem_layout.py b/base/deploy/src/scriptlets/subsystem_layout.py index 87ccef888..65b760fc2 100644 --- a/base/deploy/src/scriptlets/subsystem_layout.py +++ b/base/deploy/src/scriptlets/subsystem_layout.py @@ -24,6 +24,7 @@ import pkiconfig as config from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet @@ -34,10 +35,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_SUBSYSTEM_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SKIP_SUBSYSTEM_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.SUBSYSTEM_SPAWN_1, __name__, + pkilogging.pki_log.info(log.SUBSYSTEM_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # establish instance-based subsystem logs util.directory.create(master['pki_subsystem_log_path']) @@ -103,7 +104,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): return self.rv def destroy(self): - config.pki_log.info(log.SUBSYSTEM_DESTROY_1, __name__, + pkilogging.pki_log.info(log.SUBSYSTEM_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # remove instance-based subsystem base if master['pki_subsystem'] == "CA": diff --git a/base/deploy/src/scriptlets/webapp_deployment.py b/base/deploy/src/scriptlets/webapp_deployment.py index 6c7672a22..3f487be58 100644 --- a/base/deploy/src/scriptlets/webapp_deployment.py +++ b/base/deploy/src/scriptlets/webapp_deployment.py @@ -28,6 +28,7 @@ import pkiconfig as config from pkiconfig import PKIConfig from pkiconfig import pki_master_dict as master import pkihelper as util +import pkilogging import pkimessages as log import pkiscriptlet @@ -39,11 +40,11 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self): if master['pki_subsystem'] in PKIConfig.PKI_TOMCAT_SUBSYSTEMS: if config.str2bool(master['pki_skip_installation']): - config.pki_log.info(log.SKIP_WEBAPP_DEPLOYMENT_SPAWN_1, + pkilogging.pki_log.info(log.SKIP_WEBAPP_DEPLOYMENT_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) return self.rv - config.pki_log.info(log.WEBAPP_DEPLOYMENT_SPAWN_1, __name__, + pkilogging.pki_log.info(log.WEBAPP_DEPLOYMENT_SPAWN_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) # Copy /usr/share/pki/server/webapps/ROOT @@ -145,7 +146,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def destroy(self): if master['pki_subsystem'] in PKIConfig.PKI_TOMCAT_SUBSYSTEMS: - config.pki_log.info(log.WEBAPP_DEPLOYMENT_DESTROY_1, __name__, + pkilogging.pki_log.info(log.WEBAPP_DEPLOYMENT_DESTROY_1, __name__, extra=PKIConfig.PKI_INDENTATION_LEVEL_1) util.directory.delete(master['pki_tomcat_webapps_subsystem_path']) return self.rv -- cgit