def checkDoubleStack(doc): r''' In double stack must be present Java SCS and at least one abap instance which central or SCS, one database but two schemas, optionally two message servers @types: IniDocument -> bool''' system = sap_discoverer.parse_system_in_pf(doc) instance = sap_discoverer.ProfileParser.parseInstance(doc) isAbapMsPresent = first(_parseUsedAbapMsDetails(doc)) is not None isJavaMsPresent = _parseUsedJavaMsDetails(doc) is not None isAbapCentral = None isAbapScs = sap_abap.isCentralServicesInstance(instance) return (system.type == sap.SystemType.DS or (isAbapMsPresent and isJavaMsPresent) or (isJavaMsPresent and (isAbapCentral or isAbapScs)))
def _discover_topology(self, shell, system, pf_path): '@types: Shell, System, str -> _Topology' sys_name = system.getName() pf_result = self._get_pf_doc(pf_path, sys_name, shell) default_pf_file, inst_pf_file, pf_doc = pf_result topology = _Topology(system, None, None, None, None) if not (default_pf_file or inst_pf_file): logger.warn("Failed to get instance profiles. " "Information about system will be used from parsed " "instance profile path") else: try: system = sap_discoverer.parse_system_in_pf(pf_doc) except ValueError, ve: logger.warn("Failed to discovery system %s. %s" % (system, ve)) #we should get the instance information any way in order to have a possibility to properly work with instance ip inst = Sfn(sap_discoverer.parse_inst_in_pf)(pf_doc) topology = _Topology(system, inst, None, None, None) else:
vector.addAll(_discoverAscsInPf(defaultPfDoc, system, systemOsh, oshPerInstance)) except SapSystemInconsistentDataException, e: logger.debugException('') raise e except: logger.warn("Failed to discover ASCS in the profile") logger.debugException('') #Making database reporting optional depending on global configuration according to QCCR1H100374 Keep a possibility option to discover SAP related database via Host Applications job do_report_database = GeneralSettingsConfigFile.getInstance().getPropertyStringValue('reportSapAppServerDatabase', 'false') if do_report_database and do_report_database.lower() == 'true': systemType = sap.SystemType.ABAP system_ = None for name, (startPfIniDoc, instPfIniDoc) in pfSetByInstName.iteritems(): doc = createPfsIniDoc(defaultPfDoc, startPfIniDoc, instPfIniDoc) system_ = system_ or sap_discoverer.parse_system_in_pf(doc) try: vector.addAll(_discoverDbsInPfs(doc, sapUtils, systemOsh)) except Exception, e: logger.warn("Failed to discover DB based for %s. %s" % (name, e)) isDs = checkDoubleStack(doc) systemType = isDs and sap.SystemType.DS or systemType if system_: system_ = sap.System(system.getName(), globalHost=system.globalHost, type_=systemType, defaultPfPath=first(defaultPf), uuid_=system_.uuid) _updateSystemOsh(system_, systemOsh) return vector