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


Python AgentUtils.isAgentInstalled方法代码示例

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


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

示例1: unInstallAgent

# 需要导入模块: import AgentUtils [as 别名]
# 或者: from AgentUtils import isAgentInstalled [as 别名]
def unInstallAgent(Framework):
    protocolName = Framework.getProperty(InventoryUtils.STATE_PROPERTY_CONNECTED_SHELL_PROTOCOL_NAME)
    logger.debug('Protocal name: ', protocolName)

    client = Framework.getConnectedClient()
    uduid = InventoryUtils.getUduid(client)
    logger.debug('UD_UNIQUE_ID: ', uduid)
    Framework.setProperty(InventoryUtils.ATTR_UD_UNIQUE_ID, uduid)

    if protocolName == ClientsConsts.DDM_AGENT_PROTOCOL_NAME:
        # Should release lock first if there will be no connected credential after agent uninstallation.
        logger.debug('The connected credential is UDA. Try to release lock first.')
        LockUtils.releaseScannerLock(Framework)

    if AgentUtils.isAgentInstalled(Framework):
        logger.debug('There is an agent in remote machine.')
        # Run uninstall command.
        shouldStop = AgentUtils.agentUnInstallRoutine(Framework)
        if shouldStop != 0:
            Framework.setStepExecutionStatus(WorkflowStepStatus.FATAL_FAILURE)
            logger.debug('Failed to uninstall agent.')
    else:
        logger.debug('There is no agent in remote machine. The job will be done.')
        reason = 'There is no agent in remote machine'
        Framework.setProperty(InventoryUtils.generateSkipStep('Check Agent UnInstalled'), reason)
    Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:28,代码来源:UnInstallAgent.py

示例2: CheckAgentInstalledBeforeInstallation

# 需要导入模块: import AgentUtils [as 别名]
# 或者: from AgentUtils import isAgentInstalled [as 别名]
def CheckAgentInstalledBeforeInstallation(Framework):
    try:
        logger.debug('Check if the UDA has already been installed...')
        agentInstalled = AgentUtils.isAgentInstalled(Framework)
        logger.debug('Agent installed result:%s' % agentInstalled)
        # Framework.setProperty('isAgentInstalled', agentInstalled)
        if agentInstalled:
            logger.debug('Check if the UDA can be connected...')
            agentConnected = isAgentConnected(Framework)
            logger.debug('Agent connecting result:%s' % agentConnected)
            # Framework.setProperty('isAgentConnected', agentConnected)
            if agentConnected:
                reason = 'The UDA has been already installed and can be connected successfully.'
                Framework.setProperty(InventoryUtils.generateSkipStep('Install Agent'), reason)
                Framework.setProperty(InventoryUtils.generateSkipStep('Check Agent Install Error Code'), reason)
                Framework.setProperty(InventoryUtils.generateSkipStep('Check Agent Installed'), reason)
            else:
                logger.debug('Agent installed but can not connect, reinstall it.')
                Framework.setProperty(InventoryUtils.STATE_PROPERTY_IS_UPGRADE, 'true')
    except:
        Framework.setStepExecutionStatus(WorkflowStepStatus.FATAL_FAILURE)
    Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:24,代码来源:CheckAgentInstalledBeforeInstallation.py


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