Ejemplo n.º 1
0
def DiscoveryMain(Framework):
	OSHVResult = ObjectStateHolderVector()
	path = Framework.getDestinationAttribute('path')
	fileName = Framework.getDestinationAttribute('fileName')

	shellUtils = None
	try:
		shellUtils = shellutils.ShellUtils(Framework)
		if shellUtils.isWinOs():
			pathAndFile = path + '\\' + fileName
		else:
			pathAndFile = path + '/' + fileName
	except:
		logger.errorException('Failed to initialize client')
	else:
		try:
			tnsFile = shellUtils.safecat(pathAndFile)
			TNSNamesParsingLib.doReadFile(shellUtils, pathAndFile, OSHVResult, tnsFile)
		except:
			logger.debugException('Unexpected doReadFile() Exception:')
	if shellUtils:
		shellUtils.closeClient()
	return OSHVResult
Ejemplo n.º 2
0
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()
    path = Framework.getDestinationAttribute('path')
    fileName = Framework.getDestinationAttribute('fileName')

    shellUtils = None
    try:
        shellUtils = shellutils.ShellUtils(Framework)
        if shellUtils.isWinOs():
            pathAndFile = path + '\\' + fileName
        else:
            pathAndFile = path + '/' + fileName
    except:
        logger.errorException('Failed to initialize client')
    else:
        try:
            tnsFile = shellUtils.safecat(pathAndFile)
            TNSNamesParsingLib.doReadFile(shellUtils, pathAndFile, OSHVResult,
                                          tnsFile)
        except:
            logger.debugException('Unexpected doReadFile() Exception:')
    if shellUtils:
        shellUtils.closeClient()
    return OSHVResult
Ejemplo n.º 3
0
			pattern = r'(^.*\\)(.*)$'
			pathDelimiter = '\\'
		else:
			pattern = '(^.*/)(.*)$'
			pathDelimiter = '/'
		
		for file in files:
			#check that we got non-empty string
			if not file or not len(file):
				continue
			fileContent = None
			try:
				#check if we've got path with filename:
				if file.endswith(pathDelimiter):
					#we've got only directory - assume that fileName is TNSNAMES
					fileContent = fileMonitor.safecat(file + TNSNAMES)
				else:
					m = re.search(pattern, file)
					if m:
						folderName = m.group(1)
						fileName = m.group(2)
						fileContent = fileMonitor.safecat(folderName + fileName)
			except:
				logger.debugException('Failed reading %s' % file)
			else:
				#check if we succeeded to read the file
				if fileContent:
					TNSNamesParsingLib.doReadFile(shellUtils, file, OSHVResult, fileContent)
		shellUtils.closeClient()
	return OSHVResult