def separateCaption(hostOSH, caption): if caption.find('Windows')>-1: spList = re.findall('SP(\\d)', caption) if len(spList) == 1: sp = spList[0] hostOSH.setAttribute('nt_servicepack', sp) else: logger.debug('Service pack cannot be identified, discovered value: \'%s\'; skipping SP attribute' % caption) caption = WMI_Connection_Utils.separateCaption(caption)[1] modeling.setHostOsName(hostOSH, caption)
def separateCaption(hostOSH, caption): if caption.find('Windows') > -1: spList = re.findall('SP(\\d)', caption) if len(spList) == 1: sp = spList[0] hostOSH.setAttribute('nt_servicepack', sp) else: logger.debug( 'Service pack cannot be identified, discovered value: \'%s\'; skipping SP attribute' % caption) caption = WMI_Connection_Utils.separateCaption(caption)[1] modeling.setHostOsName(hostOSH, caption)
def DiscoveryMain(Framework): vector = ObjectStateHolderVector() (vec, warnList, errList) = WMI_Connection_Utils.mainFunction(Framework) logger.debug('OSHVector contains ', vec.size(), ' objects.') # just in case we couldnt do any connection if vec.size() == 0: for errobj in errList: logger.reportErrorObject(errobj) for errobj in warnList: logger.reportWarningObject(errobj) else: vector.addAll(vec) return vector