def discoverConfigFile(siebelRootDir, appServerOSH, client, version,
                       OSHVResult):
    shellUtils = ShellUtils(client)
    relativePaths = ['']
    protocolType = client.getClientType()
    if protocolType == ClientsConsts.NTCMD_PROTOCOL_NAME:
        relativePaths = ['\\bin\\ENU\\', '\\bin\\']
    else:
        relativePaths = ['/bin/enu/', '/bin/ENU/', '/bin/']

    found = 0
    for relativePath in relativePaths:
        path = siebelRootDir + relativePath + 'siebel.cfg'
        try:
            data = shellUtils.safecat(path)
            if not error(data, protocolType):
                found = 1
                break
        except:
            pass
    if found == 0:
        logger.error('Failed getting configuration file')
        return

    if version != None and version != '' and (version[0] == '6'
                                              or version.find('7.8') == 0):
        updateMissingAttributes(data, appServerOSH, OSHVResult)

    lastUpdateTime = file_ver_lib.getFileLastModificationTime(shellUtils, path)

    configfile = modeling.createConfigurationDocumentOSH(
        'siebel.cfg', '', data, appServerOSH, modeling.MIME_TEXT_PLAIN,
        lastUpdateTime, "Configuration file of siebel application server")
    logger.debug('found siebel config file:')
    OSHVResult.add(configfile)
def discoverConfigFile(siebelRootDir,appServerOSH,client,version,OSHVResult):
	shellUtils = ShellUtils(client)
	relativePaths = ['']
	protocolType = client.getClientType()
	if protocolType == ClientsConsts.NTCMD_PROTOCOL_NAME:
		relativePaths = ['\\bin\\ENU\\','\\bin\\']
	else:
		relativePaths = ['/bin/enu/','/bin/ENU/','/bin/']

	found = 0
	for relativePath in relativePaths:
		path = siebelRootDir + relativePath + 'siebel.cfg'
		try:
			data = shellUtils.safecat(path)
			if not error(data,protocolType):
				found = 1
				break
		except:
			pass
	if  found==0:
		logger.error('Failed getting configuration file')
		return

	if version != None and version != '' and (version[0] == '6' or version.find('7.8') == 0):
		updateMissingAttributes(data,appServerOSH,OSHVResult)

	lastUpdateTime = file_ver_lib.getFileLastModificationTime(shellUtils, path)

	configfile = modeling.createConfigurationDocumentOSH('siebel.cfg', '', data, appServerOSH, modeling.MIME_TEXT_PLAIN, lastUpdateTime, "Configuration file of siebel application server")	
	logger.debug('found siebel config file:')
	OSHVResult.add(configfile)
示例#3
0
def discoverITS(client, installpath, WEBSERVER_ID, OSHVResult):

    shellUtils = ShellUtils(client)

    webserverOSH = modeling.createOshByCmdbIdString('webserver', WEBSERVER_ID)

    sapitsOSH = ObjectStateHolder('sap_its_wgate')
    sapitsOSH.setAttribute('data_name', 'ITS_' + client.getIpAddress())
    sapitsOSH.setContainer(webserverOSH)
    OSHVResult.add(sapitsOSH)

    mapInstanceNameToAgate = getAgates(shellUtils, installpath, sapitsOSH, OSHVResult)

    filePath = installpath + '\\config\\ItsRegistryALL.xml'
    data = shellUtils.safecat(filePath)

    logger.debug('got ItsRegistryALL file')
    # data = stripNtcmdHeaders(data)
    if data == None or error(data):
        logger.error('No data found')
    else:
        builder = SAXBuilder(0)
        doc = builder.build(StringReader(data))
        root = doc.getRootElement()
        keyElem = getElementByAttrValue(root, 'key', 'name', 'AGate')
        instancesRoot = getElementByAttrValue(keyElem, 'key', 'name', 'Instances')
        instances = instancesRoot.getChildren('value')
        it = instances.iterator()
        while it.hasNext():
            instance = it.next()
            name = instance.getText()
            agates = mapInstanceNameToAgate.get(name)
            if agates != None and agates.isEmpty() == 0:
                servers(name, installpath, sapitsOSH, agates, shellUtils, OSHVResult)
示例#4
0
def discoverITS(client, installpath, WEBSERVER_ID, OSHVResult):

    shellUtils = ShellUtils(client)

    webserverOSH = modeling.createOshByCmdbIdString('webserver', WEBSERVER_ID)

    sapitsOSH = ObjectStateHolder('sap_its_wgate')
    sapitsOSH.setAttribute('data_name', 'ITS_' + client.getIpAddress())
    sapitsOSH.setContainer(webserverOSH)
    OSHVResult.add(sapitsOSH)

    mapInstanceNameToAgate = getAgates(shellUtils, installpath, sapitsOSH,
                                       OSHVResult)

    filePath = installpath + '\\config\\ItsRegistryALL.xml'
    data = shellUtils.safecat(filePath)

    logger.debug('got ItsRegistryALL file')
    # data = stripNtcmdHeaders(data)
    if data == None or error(data):
        logger.error('No data found')
    else:
        builder = SAXBuilder(0)
        doc = builder.build(StringReader(data))
        root = doc.getRootElement()
        keyElem = getElementByAttrValue(root, 'key', 'name', 'AGate')
        instancesRoot = getElementByAttrValue(keyElem, 'key', 'name',
                                              'Instances')
        instances = instancesRoot.getChildren('value')
        it = instances.iterator()
        while it.hasNext():
            instance = it.next()
            name = instance.getText()
            agates = mapInstanceNameToAgate.get(name)
            if agates != None and agates.isEmpty() == 0:
                servers(name, installpath, sapitsOSH, agates, shellUtils,
                        OSHVResult)