From cfb1486b7693b208c99f1853763404b2b5f68322 Mon Sep 17 00:00:00 2001 From: Ade Lee Date: Fri, 6 Jun 2014 21:46:04 +0800 Subject: Modify master_dict to mdict to improve readability Most of the install python scripts do not meet PEP8 including being less than 80 chars. Changing master_dict to mdict helps fix this and improves or at least does not degrade readability. --- .../server/deployment/scriptlets/finalization.py | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'base/server/python/pki/server/deployment/scriptlets/finalization.py') diff --git a/base/server/python/pki/server/deployment/scriptlets/finalization.py b/base/server/python/pki/server/deployment/scriptlets/finalization.py index 5186baa40..900bcef97 100644 --- a/base/server/python/pki/server/deployment/scriptlets/finalization.py +++ b/base/server/python/pki/server/deployment/scriptlets/finalization.py @@ -32,15 +32,15 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): def spawn(self, deployer): - if (deployer.master_dict['pki_subsystem'] == "CA" or - config.str2bool(deployer.master_dict['pki_standalone'])) and\ - config.str2bool(deployer.master_dict['pki_external_step_two']): + if (deployer.mdict['pki_subsystem'] == "CA" or + config.str2bool(deployer.mdict['pki_standalone'])) and\ + config.str2bool(deployer.mdict['pki_external_step_two']): # For External CAs (Step 2), or Stand-alone PKIs (Step 2), # must check for (Step 2) installation PRIOR to # 'pki_skip_installation' since this value has been set to true # by the initialization scriptlet pass - elif config.str2bool(deployer.master_dict['pki_skip_installation']): + elif config.str2bool(deployer.mdict['pki_skip_installation']): config.pki_log.info(log.SKIP_FINALIZATION_SPAWN_1, __name__, extra=config.PKI_INDENTATION_LEVEL_1) return self.rv @@ -48,24 +48,24 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): extra=config.PKI_INDENTATION_LEVEL_1) # For debugging/auditing purposes, save a timestamped copy of # this configuration file in the subsystem archive - deployer.file.copy(deployer.master_dict['pki_user_deployment_cfg_replica'], - deployer.master_dict['pki_user_deployment_cfg_spawn_archive']) + deployer.file.copy(deployer.mdict['pki_user_deployment_cfg_replica'], + deployer.mdict['pki_user_deployment_cfg_spawn_archive']) # Save a copy of the installation manifest file - config.pki_log.info(log.PKI_MANIFEST_MESSAGE_1, deployer.master_dict['pki_manifest'], + config.pki_log.info(log.PKI_MANIFEST_MESSAGE_1, deployer.mdict['pki_manifest'], extra=config.PKI_INDENTATION_LEVEL_2) # for record in manifest.database: # print tuple(record) manifest_file = manifest.File(deployer.manifest_db) - manifest_file.register(deployer.master_dict['pki_manifest']) + manifest_file.register(deployer.mdict['pki_manifest']) manifest_file.write() - deployer.file.modify(deployer.master_dict['pki_manifest'], silent=True) + deployer.file.modify(deployer.mdict['pki_manifest'], silent=True) # Also, for debugging/auditing purposes, save a timestamped copy of # this installation manifest file - deployer.file.copy(deployer.master_dict['pki_manifest'], - deployer.master_dict['pki_manifest_spawn_archive']) + deployer.file.copy(deployer.mdict['pki_manifest'], + deployer.mdict['pki_manifest_spawn_archive']) # Optionally, programmatically 'restart' the configured PKI instance - if config.str2bool(deployer.master_dict['pki_restart_configured_instance']): + if config.str2bool(deployer.mdict['pki_restart_configured_instance']): deployer.systemd.restart() # Optionally, 'purge' the entire temporary client infrastructure # including the client NSS security databases and password files @@ -74,35 +74,35 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet): # placed under this infrastructure, it may accidentally # be deleted! # - if config.str2bool(deployer.master_dict['pki_client_database_purge']): - if deployer.directory.exists(deployer.master_dict['pki_client_subsystem_dir']): - deployer.directory.delete(deployer.master_dict['pki_client_subsystem_dir']) + if config.str2bool(deployer.mdict['pki_client_database_purge']): + if deployer.directory.exists(deployer.mdict['pki_client_subsystem_dir']): + deployer.directory.delete(deployer.mdict['pki_client_subsystem_dir']) # If instance has not been configured, print the # configuration URL to the log - if config.str2bool(deployer.master_dict['pki_skip_configuration']): + if config.str2bool(deployer.mdict['pki_skip_configuration']): deployer.configuration_file.log_configuration_url() # Log final process messages config.pki_log.info(log.PKISPAWN_END_MESSAGE_2, - deployer.master_dict['pki_subsystem'], - deployer.master_dict['pki_instance_name'], + deployer.mdict['pki_subsystem'], + deployer.mdict['pki_instance_name'], extra=config.PKI_INDENTATION_LEVEL_0) - deployer.file.modify(deployer.master_dict['pki_spawn_log'], silent=True) + deployer.file.modify(deployer.mdict['pki_spawn_log'], silent=True) return self.rv def destroy(self, deployer): config.pki_log.info(log.FINALIZATION_DESTROY_1, __name__, extra=config.PKI_INDENTATION_LEVEL_1) - deployer.file.modify(deployer.master_dict['pki_destroy_log'], silent=True) + deployer.file.modify(deployer.mdict['pki_destroy_log'], silent=True) # Start this Apache/Tomcat PKI Process - if deployer.master_dict['pki_subsystem'] in config.PKI_APACHE_SUBSYSTEMS and\ + if deployer.mdict['pki_subsystem'] in config.PKI_APACHE_SUBSYSTEMS and\ deployer.instance.apache_instance_subsystems() >= 1: deployer.systemd.start() - elif deployer.master_dict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS and\ + elif deployer.mdict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS and\ len(deployer.instance.tomcat_instance_subsystems()) >= 1: deployer.systemd.start() config.pki_log.info(log.PKIDESTROY_END_MESSAGE_2, - deployer.master_dict['pki_subsystem'], - deployer.master_dict['pki_instance_name'], + deployer.mdict['pki_subsystem'], + deployer.mdict['pki_instance_name'], extra=config.PKI_INDENTATION_LEVEL_0) return self.rv -- cgit