diff --git a/base/server/python/pki/server/deployment/pkihelper.py b/base/server/python/pki/server/deployment/pkihelper.py index d287bf27ada..2fbf13831a4 100644 --- a/base/server/python/pki/server/deployment/pkihelper.py +++ b/base/server/python/pki/server/deployment/pkihelper.py @@ -283,152 +283,6 @@ class Namespace: def __init__(self, deployer): self.mdict = deployer.mdict - # Run simple checks for pre-existing namespace collisions - def collision_detection(self, instance): - - subsystem_path = os.path.join( - instance.base_dir, - self.mdict['pki_subsystem_type']) - - if os.path.exists(instance.base_dir): - if os.path.exists(subsystem_path): - # Top-Level PKI base path collision - logger.error( - log.PKIHELPER_NAMESPACE_COLLISION_2, - self.mdict['pki_instance_name'], - instance.base_dir) - raise Exception( - log.PKIHELPER_NAMESPACE_COLLISION_2 % ( - self.mdict['pki_instance_name'], - instance.base_dir)) - else: - if os.path.exists(instance.service_conf): - # Top-Level "/etc/sysconfig" path collision - logger.error( - log.PKIHELPER_NAMESPACE_COLLISION_2, - self.mdict['pki_instance_name'], - instance.service_conf) - raise Exception( - log.PKIHELPER_NAMESPACE_COLLISION_2 % ( - self.mdict['pki_instance_name'], - instance.service_conf)) - - cgroup_systemd_service_path = \ - '/sys/fs/cgroup/systemd/system' + \ - pki.server.instance.PKIInstance.UNIT_FILE - - cgroup_systemd_service = os.path.join( - cgroup_systemd_service_path, - instance.name) - - if os.path.exists(cgroup_systemd_service): - # Systemd cgroup path collision - logger.error( - log.PKIHELPER_NAMESPACE_COLLISION_2, - self.mdict['pki_instance_name'], - cgroup_systemd_service_path) - raise Exception( - log.PKIHELPER_NAMESPACE_COLLISION_2 % ( - self.mdict['pki_instance_name'], - cgroup_systemd_service_path)) - - cgroup_cpu_systemd_service_path = \ - '/sys/fs/cgroup/cpu,cpuacct/system' + \ - pki.server.instance.PKIInstance.UNIT_FILE - - cgroup_cpu_systemd_service = \ - cgroup_cpu_systemd_service_path + \ - pki.server.instance.PKIInstance.UNIT_FILE - - if os.path.exists(cgroup_cpu_systemd_service): - # Systemd cgroup CPU path collision - logger.error( - log.PKIHELPER_NAMESPACE_COLLISION_2, - self.mdict['pki_instance_name'], - cgroup_cpu_systemd_service_path) - raise Exception( - log.PKIHELPER_NAMESPACE_COLLISION_2 % ( - self.mdict['pki_instance_name'], - cgroup_cpu_systemd_service_path)) - - subsystem_log_dir = os.path.join( - instance.log_dir, - self.mdict['pki_subsystem_type']) - - if os.path.exists(instance.log_dir) and\ - os.path.exists(subsystem_log_dir): - # Check if logs already exist. If so, append to it. Log it as info - logger.info( - log.PKIHELPER_LOG_REUSE, - instance.log_dir) - - subsystem_conf_dir = os.path.join( - instance.conf_dir, - self.mdict['pki_subsystem_type']) - - if os.path.exists(instance.conf_dir) and\ - os.path.exists(subsystem_conf_dir): - # Top-Level PKI configuration path collision - logger.error( - log.PKIHELPER_NAMESPACE_COLLISION_2, - self.mdict['pki_instance_name'], - instance.conf_dir) - raise Exception( - log.PKIHELPER_NAMESPACE_COLLISION_2 % ( - self.mdict['pki_instance_name'], - instance.conf_dir)) - - subsystem_registry_dir = os.path.join( - instance.registry_dir, - self.mdict['pki_subsystem_type']) - - if os.path.exists(instance.registry_dir) and\ - os.path.exists(subsystem_registry_dir): - # Top-Level PKI registry path collision - logger.error( - log.PKIHELPER_NAMESPACE_COLLISION_2, - self.mdict['pki_instance_name'], - instance.registry_dir) - raise Exception( - log.PKIHELPER_NAMESPACE_COLLISION_2 % ( - self.mdict['pki_instance_name'], - instance.registry_dir)) - # Run simple checks for reserved name namespace collisions - if self.mdict['pki_instance_name'] in config.PKI_BASE_RESERVED_NAMES: - # Top-Level PKI base path reserved name collision - logger.error( - log.PKIHELPER_NAMESPACE_RESERVED_NAME_2, - self.mdict['pki_instance_name'], - instance.base_dir) - raise Exception( - log.PKIHELPER_NAMESPACE_RESERVED_NAME_2 % ( - self.mdict['pki_instance_name'], - instance.base_dir)) - # No need to check for reserved name under Top-Level PKI log path - if self.mdict['pki_instance_name'] in \ - config.PKI_CONFIGURATION_RESERVED_NAMES: - # Top-Level PKI configuration path reserved name collision - logger.error( - log.PKIHELPER_NAMESPACE_RESERVED_NAME_2, - self.mdict['pki_instance_name'], - instance.conf_dir) - raise Exception( - log.PKIHELPER_NAMESPACE_RESERVED_NAME_2 % ( - self.mdict['pki_instance_name'], - instance.conf_dir)) - - # Top-Level Tomcat PKI registry path reserved name collision - if self.mdict['pki_instance_name'] in\ - config.PKI_TOMCAT_REGISTRY_RESERVED_NAMES: - logger.error( - log.PKIHELPER_NAMESPACE_RESERVED_NAME_2, - self.mdict['pki_instance_name'], - instance.registry_dir) - raise Exception( - log.PKIHELPER_NAMESPACE_RESERVED_NAME_2 % ( - self.mdict['pki_instance_name'], - instance.registry_dir)) - class ConfigurationFile: """PKI Deployment Configuration File Class"""