当前位置: 首页>>代码示例>>Python>>正文


Python Boolean.parseBoolean方法代码示例

本文整理汇总了Python中java.lang.Boolean.parseBoolean方法的典型用法代码示例。如果您正苦于以下问题:Python Boolean.parseBoolean方法的具体用法?Python Boolean.parseBoolean怎么用?Python Boolean.parseBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.Boolean的用法示例。


在下文中一共展示了Boolean.parseBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DiscoveryMain

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
def DiscoveryMain(Framework):
    shell = None
    try:
        try:
            protocolName = __getProtocolName(Framework)
            discoverSharePointUrls = Boolean.parseBoolean(Framework.getParameter('discoverSharePointUrls'))
            reportIntermediateWebService = Framework.getParameter('reportIntermediateWebService')
            if reportIntermediateWebService:
                reportIntermediateWebService = Boolean.parseBoolean(reportIntermediateWebService)
            else:
                #set default value
                reportIntermediateWebService = 1
            relativeCommandTimeoutMultiplier = Framework.getParameter('relativeCommandTimeoutMultiplier')
            relativeCommandTimeoutMultiplier = int(relativeCommandTimeoutMultiplier)
            client = Framework.createClient()
            shell = ShellFactory().createShell(client)
            logger.debug('getting SharePoint discoverer for protocol %s' % protocolName)
            discoverer = sharepoint_win_shell.getDiscoverer(shell, protocolName, relativeCommandTimeoutMultiplier)
            logger.debug('got discoverer')
            resources = _discoverSharePoint(discoverer)
            resources.build()
            return resources.report(discoverSharePointUrls, reportIntermediateWebService)
        except SharePointException:
            logger.reportError()
            logger.debugException('')
        except JavaException, ex:
            strException = ex.getMessage()
            errormessages.resolveAndReport(strException, protocolName, Framework)
        except:
            strException = logger.prepareJythonStackTrace('')
            errormessages.resolveAndReport(strException, protocolName, Framework)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:33,代码来源:SharePointMain.py

示例2: start

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
 def start(self):
     "start enabler"
     
     logger.info("Enter start")
     copyContainerEnvironment()
     self.__initOptions()
      
     if self.__composeFile:
         self.__composeCreate()
         self.__composeStart()
         self.__composePs()
     else:
         reuseContainer = Boolean.parseBoolean(getVariableValue("REUSE_DOCKER_CONTAINER", "false"))
         reuseImage = Boolean.parseBoolean(getVariableValue("REUSE_DOCKER_IMAGE", "true"))
     
         llen = len(self.__dockerContainerName)
         for index in range(llen):
             if reuseContainer and self.__containerExists(index):
                 self.__start(index)
             elif reuseImage and self.__imageExists(index):
                 self.__run(index)
             elif listItem(self.__dockerContext, index):
                 self.__build(index)
                 self.__run(index)
             else:
                 self.__pull(index)
                 self.__run(index)
         
             while index < (llen - 1):
                 logger.info("Waiting for container to start:" + listItem(self.__dockerContainerName, index))
                 time.sleep(float(self.__startInterval))
                 if self.__isContainerRunning(index):
                     break
   
     logger.info("Exit start")
开发者ID:ajayvohra2005,项目名称:simple-docker-enabler,代码行数:37,代码来源:SimpleDockerEnabler.py

示例3: initializeServices

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
    def initializeServices(self):
        self.discoverDependLinks = 1
        self.shouldCountClients = 0
        self.updateUtilizationInfo = Boolean.parseBoolean(self.getParameterValue('updateUtilizationInfo'))
        self.onlyHostDependLinks = Boolean.parseBoolean(self.getParameterValue('onlyHostDependLinks'))
        self.ignoreUnackedTcpConn = Boolean.parseBoolean(self.getParameterValue('ignoreUnackedTcpConn'))

        self.minimalClients = 0
        self.minimalOctets = 0
        self.minimalPackets = 0
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:12,代码来源:Netlinks_Servers.py

示例4: DiscoveryMain

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
def DiscoveryMain(Framework):
    properties = Properties()

    SITE_ID = Framework.getDestinationAttribute('SITE_ID')
    instance_number = Framework.getDestinationAttribute('instance_number')
    connection_client = Framework.getDestinationAttribute('connection_client')
    logger.debug('Connecting to a SAP instance number:', str(instance_number))
    properties.setProperty(Protocol.SAP_PROTOCOL_ATTRIBUTE_SYSNUMBER, instance_number)

    if (connection_client is not None) and (connection_client != 'NA'):
        logger.debug('Connecting to a SAP system with client:', str(connection_client))
        properties.setProperty(Protocol.SAP_PROTOCOL_ATTRIBUTE_CLIENT, connection_client)
    discoverScenarioProcesses = Boolean.parseBoolean(Framework.getParameter('discoverScenarioProcesses'))
    GET_PROCESS_STEPS = Boolean.parseBoolean(Framework.getParameter('getProcessSteps'))
    reportCIsInChunks = Boolean.parseBoolean(Framework.getParameter('reportCIsInChunks'))

    errormsg = ''
    client = None
    try:
        try:
            client = Framework.createClient(properties)
            solman = saputils.SapSolman(client)
        except (NoClassDefFoundError, MissingJarsException, ExceptionInInitializerError):
            errormsg = 'SAP drivers are missing'
            logger.debugException(errormsg)
        except:
            errormsg = 'Connection failed'
            logger.debugException(errormsg)
        else:
            try:
                sVector, sysToOshPairs = discoverSystems(solman)
                Framework.sendObjects(sVector)
                sVector.clear()
                sysNames = [system.getName() for system, _ in sysToOshPairs]
                sys_name_to_system = {}
                for system, _ in sysToOshPairs:
                    sys_name_to_system[system.getName()] = system

                component2system = logicalComponents(sysNames, solman)
                businessProcesses(Framework, solman, component2system,
                                  sys_name_to_system, SITE_ID, GET_PROCESS_STEPS, reportCIsInChunks,
                                  discoverScenarioProcesses)
            except:
                strmsg = str(sys.exc_info()[1])
                if (strmsg.upper().find('TABLE_NOT_AVAILABLE') > -1):
                    errmsg = 'No solution manager found'
                    logger.debugException(errmsg)
                    Framework.reportError(errmsg)
                else:
                    # unknown exception caught
                    raise
    except JException, ex:
        ex_info = ex.getMessage()
        errormessages.resolveAndReport(ex_info, 'SAP JCO', Framework)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:56,代码来源:sap_solution_manager.py

示例5: isStampEnabled

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
def isStampEnabled(Framework, ip):
    from java.lang import Boolean

    enableStampingParameter = Framework.getParameter('enableStamping')
    onlyStampingClientParameter = Framework.getParameter('onlyStampingClient')
    logger.debug("Parameter for enableStamping:", enableStampingParameter)
    logger.debug("Parameter for onlyStampingClient:", onlyStampingClientParameter)
    enableStamping = Boolean.parseBoolean(enableStampingParameter)
    onlyStampingClient = Boolean.parseBoolean(onlyStampingClientParameter)
    isClientIP = isClientTypeIP(ip)

    return enableStamping and (not onlyStampingClient or isClientIP)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:14,代码来源:HostConnectionByShell.py

示例6: initializeServices

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
    def initializeServices(self):
        self.updateUtilizationInfo = 1
        self.discoverDependLinks = Boolean.parseBoolean(self.getParameterValue('discoverDependLinks'))
        self.onlyHostDependLinks = 0
        self.ignoreUnackedTcpConn = 0
        self.shouldCountClients = 1

        self.discoverIP = self.Framework.getDestinationAttribute('ip_address')
        self.hostId = self.Framework.getDestinationAttribute('hostId')
        self.minimalClients = Integer.parseInt(self.Framework.getParameter('minClients'))
        self.minimalOctets = Integer.parseInt(self.Framework.getParameter('minOctets'))
        self.minimalPackets = Integer.parseInt(self.Framework.getParameter('minPackets'))
        self.protocols = self.Framework.getParameter('protocols')
        self.disregardListenPorts = Boolean.parseBoolean(self.getParameterValue('disregardListenPorts'))
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:16,代码来源:Netlinks_Potential_Servers.py

示例7: shouldInstallScanner

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
def shouldInstallScanner(scannerPlatformConfig, Framework, shell):
	shouldInstall = 0
	#staring to check scanner version on remote machine
	isUpgradeAllowed = Boolean.parseBoolean(Framework.getParameter('IsScannerUpgradeAllowed'))
	logger.debug('Parameter isUpgradeAllowed:', isUpgradeAllowed)
	IsDowngradeAllowed = Boolean.parseBoolean(Framework.getParameter('IsScannerDowngradeAllowed'))
	logger.debug('Parameter IsDowngradeAllowed:', IsDowngradeAllowed)

	if isUpgradeAllowed and IsDowngradeAllowed:
		logger.debug('Upgrade and Downgrade allowed, installing scanner in any case')
		shouldInstall = 1
	else:
		remoteScannerVersion = Framework.getDestinationAttribute('scannerVersion')
		if (remoteScannerVersion is None) or (len(str(remoteScannerVersion)) == 0) or (str(remoteScannerVersion) == 'NA'):
			logger.debug('Remote scanner version is unavailable, going to execute scanner upgrade')
			shouldInstall = 1
		else:
			logger.debug('Scanner already found on remote machine')
			installerFileName = scannerPlatformConfig.getScannerExecutable()
			installerVersioninstallerXmlFilePath = CollectorsParameters.PROBE_MGR_RESOURCES_DIR + 'ud_scanners' + str(File.separator) + installerFileName + '-version.xml'
			logger.debug('Checking installer version in file ', installerVersioninstallerXmlFilePath)
			installerXmlFile = File(installerVersioninstallerXmlFilePath)
			if installerXmlFile.exists() and installerXmlFile.isFile():
				installerVersion = getInstallerVersion(installerXmlFile, Framework)
				logger.debug('Current scanner version ', installerVersion)
				m = re.search('([\d\.]+) build ([\d]+)', remoteScannerVersion)
				if m:
					remoteScannerVersion = m.group(1)+'.'+m.group(2)
					logger.debug('Remote scanner version ', remoteScannerVersion)
					if compareVersions(installerVersion, remoteScannerVersion) > 0:
						if isUpgradeAllowed:
							logger.debug('Upgrade should be perfomed')
							shouldInstall = 1
						else:
							logger.debug('Upgrade is not allowed')
					elif compareVersions(installerVersion, remoteScannerVersion) < 0:
						if IsDowngradeAllowed:
							logger.debug('Downgrade should be perfomed')
							shouldInstall = 1
						else:
							logger.debug('Downgrade is not allowed')
				else:
					logger.debug('Scanner should be installed')
					shouldInstall = 1
			else:
				if isUpgradeAllowed:
					logger.debug('Going to upgrade scanner, version file not exists:', installerVersioninstallerXmlFilePath)
					shouldInstall = 1
	return shouldInstall
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:51,代码来源:UpgradeScanner.py

示例8: __activate__

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
    def __activate__(self, context):
        self.velocityContext = context
        self.services = context["Services"]
        self.request = context["request"]
        self.response = context["response"]
        self.contextPath = context["contextPath"]
        self.formData = context["formData"]
        self.page = context["page"]

        self.uaActivated = False
        useDownload = Boolean.parseBoolean(self.formData.get("download", "true"))
        self.__isPreview = Boolean.parseBoolean(self.formData.get("preview", "false"))
        self.__previewPid = None
        self.__hasPid = False

        uri = URLDecoder.decode(self.request.getAttribute("RequestURI"))
        matches = re.match("^(.*?)/(.*?)/(?:(.*?)/)?(.*)$", uri)
        if matches and matches.group(3):
            oid = matches.group(3)
            pid = matches.group(4)

            self.__metadata = JsonConfigHelper()
            self.__object = self.__getObject(oid)
            self.__oid = oid

            # If we have a PID
            if pid:
                self.__hasPid = True
                if useDownload:
                    # Download the payload to support relative links
                    download = DownloadData()
                    download.__activate__(context)
                else:
                    # Render the detail screen with the alternative preview
                    self.__readMetadata(oid)
                    self.__previewPid = pid
            # Otherwise, render the detail screen
            else:
                self.__readMetadata(oid)
                self.__previewPid = self.getPreview()

            if self.__previewPid:
                self.__previewPid = URLEncoder.encode(self.__previewPid, "UTF-8")
        else:
            # require trailing slash for relative paths
            q = ""
            if self.__isPreview:
                q = "?preview=true"
            self.response.sendRedirect("%s/%s/%s" % (self.contextPath, uri, q))
开发者ID:kiranba,项目名称:the-fascinator,代码行数:51,代码来源:detail.py

示例9: disHPUX

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
def disHPUX(host_obj, client, Framework = None, langBund = None, pid2Process = None):
	hostId = Framework.getDestinationAttribute('hostId')
	discoverProcesses = Boolean.parseBoolean(Framework.getParameter('discoverProcesses'))

	myVec = ObjectStateHolderVector()
	
	# Better format, but not supported on all HPUX systems
	#r = client.executeCmd('ps -e -o pid,time,sz,comm,args')
	r = client.execCmd('ps -ef')#[email protected]@CMD_PERMISION tty protocol execution
	if r == None:
		return myVec

	lines = ''
	if(re.search('\r\n',r)):
		lines = r.split('\r\n')
	elif (re.search('\n',r)):
		lines = r.split('\n')
	else:
		return myVec
	processList = []
	pdu = None
	try:
		pdu = processdbutils.ProcessDbUtils(Framework)
		hostOSH = None
		for line in lines:
			## Reg for processes with args
			res = re.search('(\w+)\s+(\d+).*\s\d+\:\d\d\s([0-9a-zA-Z_.\[\]\-+:/]+)\s(.*)',line)
			if(res):
				cleanArgs = res.group(4)
			else:
				## Reg for processes with no args
				res = re.search('(\w+)\s+(\d+).*\s\d+\:\d\d\s([0-9a-zA-Z_.\-+:/]+)',line)
				if(res):
					cleanArgs = ''
			if(res):
				owner = res.group(1)
				commAndPath = res.group(3)
				pid = res.group(2)
				cleanCommand = ''
				if commAndPath.find('/') == -1:
					cleanCommand = commAndPath
				else:
					res2 = re.search('(.*/)([^/]+)',commAndPath)
					if (res2):
						cleanCommand = res2.group(2)
					else:
						continue
				if hostOSH == None:
					hostOSH = modeling.createOshByCmdbIdString('host', hostId)
				
				commandLine = cleanCommand + ' ' + cleanArgs
				addProcess(pdu, hostId, cleanCommand, pid, commandLine, commAndPath, cleanArgs, processList, discoverProcesses, myVec, hostOSH, None, owner)

		pdu.flushHostProcesses(hostId)
		if pid2Process is not None:
			pid2Process.putAll(pdu.getProcessCmdMap())
	finally:
		if pdu != None:
			pdu.close()
	return myVec
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:62,代码来源:TTY_HR_Process_Lib.py

示例10: DiscoveryMain

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()

    logger.info ("Starting IMS Discovery")
    DiscoverIMSDB = Boolean.parseBoolean(Framework.getParameter('DiscoverIMSDB'))

    # create LPAR node from the ID passed in
    hostId = Framework.getDestinationAttribute(PARAM_HOST_ID)
    lparOsh = None

    if eview_lib.isNotNull(hostId):
        lparOsh = modeling.createOshByCmdbIdString('host_node', hostId)

    ls = eview_lib.EvShell(Framework)
    IMSSubSysDict = getIMSSubSys(ls, lparOsh)
    OSHVResult.addAll(getIMSActRegions(ls,lparOsh, IMSSubSysDict ))


    if DiscoverIMSDB and len(IMSSubSysDict) > 0:
        databaseAreaDictionary = {}
        databaseDictionary = {}
        OSHVResult.addAll(getIMSDB(ls, IMSSubSysDict,  databaseAreaDictionary , databaseDictionary))
        OSHVResult.addAll(getAREAs(ls, IMSSubSysDict,  databaseAreaDictionary , databaseDictionary))
        OSHVResult.addAll(processPrograms(ls,IMSSubSysDict, Framework))
    ls.closeClient()

    logger.info ("Finished IMS Discovery")
    return OSHVResult
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:30,代码来源:eview_ims.py

示例11: __init__

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
    def __init__(self, Framework):
        Netlinks_Service.NetlinksService.__init__(self, Framework)
        shouldIgnoreLocal = self.getParameterValue('ignoreLocalConnections')
        if shouldIgnoreLocal == None:
            shouldIgnoreLocal = 'false'
        self.ignoreLocalConnections = Boolean.parseBoolean(shouldIgnoreLocal)
        self.dependencyNameIsKey = modeling.checkIsKeyAttribute('dependency', 'dependency_name')
        self.dependencySourceIsKey = modeling.checkIsKeyAttribute('dependency', 'dependency_source')
        ignoredIpsList = self.getParameterValue('ignoredIps')
        self.ignoredIps = None
        if ignoredIpsList != None:
            ipPatterns = ignoredIpsList.split(',')
            if (len(ipPatterns) > 0) and (ipPatterns[0] != ''):
                for ipPattern in ipPatterns:
                    pattern = String(ipPattern)
                    pattern = String(pattern.replaceAll("\.", "\\\."))
                    pattern = String(pattern.replaceAll("\*", "\\\d+"))
                    try:
                        m = Pattern.compile(pattern)
                        if self.ignoredIps == None:
                            self.ignoredIps = ArrayList()
                        self.ignoredIps.add(m)
                    except:
                        logger.debug('Failed to compile ip pattern:', ipPattern)


        self.initializeServices()
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:29,代码来源:Netlinks_Services.py

示例12: __composeDown

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
 def __composeDown(self):
     
     logger.info("Enter docker compose down")
     try:
         project = getVariableValue("DOCKER_COMPOSE_PROJECT", self.__compName)
         cmdlist=[self.__dockerCompose, "--file", self.__composeFile, "--project-name", project, "down"]
         removeImage = Boolean.parseBoolean(getVariableValue("REMOVE_DOCKER_IMAGE", "false"))
        
         if removeImage:
             cmdlist.extend(["--rmi", "all"])
             
         removeOptions = getVariableValue("DOCKER_REMOVE_OPTIONS")
         if removeOptions and removeOptions.find("--volumes=true") >= 0:
             cmdlist.append("--volumes")
             
         logger.info("Executing:"+ list2str(cmdlist))
         os.environ["DOCKER_HOST"] = "tcp://" + self.__dockerAddr
         os.environ["COMPOSE_HTTP_TIMEOUT"] = "300"
         self.__lock()
         retcode = call(cmdlist)
         logger.info("Return code:" + str(retcode))
     except:
         type, value, traceback = sys.exc_info()
         logger.severe("composeDown error:" + `value`)
         raise
     finally:
         self.__unlock()
             
     logger.info("Exit docker compose down")
开发者ID:ajayvohra2005,项目名称:simple-docker-enabler,代码行数:31,代码来源:SimpleDockerEnabler.py

示例13: __activate__

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
 def __activate__(self, context):
     self.services = context["Services"]
     self.page = context["page"]
     self.formData = context["formData"]
     self.sessionState = context["sessionState"]
     self.request = context["request"]
     self.pageName = context["pageName"]
     
     self.__portal = context["page"].getPortal()
     sessionNav = self.__portal.get("portal/use-session-navigation", "true")
     self.__useSessionNavigation = Boolean.parseBoolean(sessionNav)
     self.__result = JsonConfigHelper()
     if self.__useSessionNavigation:
         self.__pageNum = self.sessionState.get("pageNum", 1)
     else:
         self.__pageNum = 1
     self.__selected = ArrayList()
     self.__fqParts = []
     self.__searchField = self.formData.get("searchField", "full_text")
     
     if self.__portal.getName() != self.lastPortalId:
         self.sessionState.remove("fq")
         self.sessionState.remove("pageNum")
         self.__pageNum = 1
         self.lastPortalId =  self.__portal.getName()
     
     self.__search()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:29,代码来源:search.py

示例14: getPayloadContent

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
 def getPayloadContent(self):
     mimeType = self.__mimeType
     print " * single.py: payload content mimeType=%s" % mimeType
     contentStr = ""
     if mimeType.startswith("text/"):
         if mimeType == "text/html":
             contentStr = '<iframe class="iframe-preview" src="%s/%s/download/%s"></iframe>' % (
                 contextPath,
                 portalId,
                 self.__oid,
             )
         else:
             pid = self.__oid[self.__oid.rfind("/") + 1 :]
             payload = self.__storage.getPayload(self.__oid, pid)
             print " * single.py: pid=%s payload=%s" % (pid, payload)
             if payload is not None:
                 sw = StringWriter()
                 sw.write("<pre>")
                 IOUtils.copy(payload.getInputStream(), sw)
                 sw.write("</pre>")
                 sw.flush()
                 contentStr = sw.toString()
     elif (
         mimeType == "application/pdf"
         or mimeType.find("vnd.ms") > -1
         or mimeType.find("vnd.oasis.opendocument.") > -1
     ):
         # get the html version if exist...
         pid = os.path.splitext(self.__pid)[0] + ".htm"
         print " * single.py: pid=%s" % pid
         # contentStr = '<iframe class="iframe-preview" src="%s/%s/download/%s/%s"></iframe>' % \
         #    (contextPath, portalId, self.__oid, pid)
         payload = self.__storage.getPayload(self.__oid, pid)
         saxReader = SAXReader(Boolean.parseBoolean("false"))
         try:
             document = saxReader.read(payload.getInputStream())
             slideNode = document.selectSingleNode("//*[local-name()='body']")
             # linkNodes = slideNode.selectNodes("//img")
             # contentStr = slideNode.asXML();
             # encode character entities correctly
             slideNode.setName("div")
             out = ByteArrayOutputStream()
             format = OutputFormat.createPrettyPrint()
             format.setSuppressDeclaration(True)
             format.setExpandEmptyElements(True)
             writer = XMLWriter(out, format)
             writer.write(slideNode)
             writer.close()
             contentStr = out.toString("UTF-8")
         except:
             traceback.print_exc()
             contentStr = '<p class="error">No preview available</p>'
     elif mimeType.startswith("image/"):
         src = "%s/%s" % (self.__oid, self.__pid)
         contentStr = (
             '<a class="image" href="%(src)s"  style="max-width:98%%">'
             '<img src="%(src)s" style="max-width:100%%" /></a>' % {"src": self.__pid}
         )
     return contentStr
开发者ID:kiranba,项目名称:the-fascinator,代码行数:61,代码来源:single.py

示例15: DiscoveryMain

# 需要导入模块: from java.lang import Boolean [as 别名]
# 或者: from java.lang.Boolean import parseBoolean [as 别名]
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()

    client = None
    layer2_connections_cdp = None
    layer2_connections_lldp = None
    try:
        try:
            client = Framework.createClient()
        except:
            errMsg ='Exception while creating %s client: %s' % (ClientsConsts.SNMP_PROTOCOL_NAME, sys.exc_info()[1])
            errormessages.resolveAndReport(str(sys.exc_info()[1]), ClientsConsts.SNMP_PROTOCOL_NAME, Framework)
            logger.debugException(errMsg)
        else:
            host_id = Framework.getDestinationAttribute('hostId')
            discover_cdp_mib = Boolean.parseBoolean(Framework.getParameter('discoverCdpMib'))
            discover_lldp_mib = Boolean.parseBoolean(Framework.getParameter('discoverLldpMib'))
            local_device_discoverer = LocalDeviceDiscoverer(client, host_id)
            local_devices = local_device_discoverer.get_local_devices()
            if not local_devices or len(local_devices) == 0:
                logger.reportError('Failed to get local device info')

            if discover_cdp_mib:
                cdp_discoverer = CdpDiscoverer(client)
                remote_devices_cdp = cdp_discoverer.get_remote_devices()
                if remote_devices_cdp:
                    layer2_connections_cdp = get_layer2_connections(local_devices, remote_devices_cdp)
                    for layer2_connection in layer2_connections_cdp:
                        OSHVResult.addAll(build_layer2_connection(layer2_connection))

            if discover_lldp_mib:
                lldp_discoverer = LldpDiscoverer(client)
                remote_devices_lldp = lldp_discoverer.get_remote_devices()
                if remote_devices_lldp:
                    layer2_connections_lldp = get_layer2_connections(local_devices, remote_devices_lldp)
                    for layer2_connection in layer2_connections_lldp:
                        OSHVResult.addAll(build_layer2_connection(layer2_connection))

            if (not layer2_connections_cdp or len(layer2_connections_cdp) == 0) and (not layer2_connections_lldp or len(layer2_connections_lldp) == 0):
                logger.reportError('No data collected')

    finally:
        if client != None:
            client.close()
    return OSHVResult
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:47,代码来源:SNMP_CDP_LLDP.py


注:本文中的java.lang.Boolean.parseBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。