本文整理汇总了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)
示例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)