예제 #1
0
def CheckInstallErrorCode(Framework):
    if AgentUtils.isUpgradeProcess(Framework):
        if AgentUtils.isUpgradeByUDAgent(Framework):
            client = Framework.getConnectedClient()
            agentVersion = client.getVersion()
            logger.debug("The current agent version is:", agentVersion)

            connectedUDACredentialId = client.getCredentialId()
            logger.debug('Credential id on remote:', connectedUDACredentialId)

            installCredentialId = Framework.getParameter(AgentUtils.UDAGENT_CONNECT_CREDENTIAL_ID_PARAM)
            logger.debug('Credential id for upgrade:', installCredentialId)

            if not AgentUtils.versionsEqual(Framework, agentVersion) or (installCredentialId
                                                                         and installCredentialId != connectedUDACredentialId):
                logger.debug("Notice: The connected client is still old UDA.")
        errorCode = AgentUtils.getUpgradeErrorCode(Framework)
    else:
        errorCode = AgentUtils.getInstallErrorCode(Framework)
    if errorCode:
        if errorCode.isSuccess():
            Framework.setProperty(CheckAgentInstalled.FIRST_TRY_INSTALL_AGENT,
                                  CheckAgentInstalled.FIRST_TRY_INSTALL_AGENT)
            Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
        elif errorCode.isInProgress():
            logger.debug('UDA install command is in progress, will check after parking')
            Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
        else:
            logger.debug('Failed to install UDA according to install error code.')
            Framework.reportError("Install/Upgrade UDA failed. Reason is:%s" % errorCode.getMessage())
            Framework.setStepExecutionStatus(WorkflowStepStatus.FATAL_FAILURE)
    else:
        logger.debug('Can not get error code now, will check after parking')
        Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
예제 #2
0
def CheckInstallErrorCode(Framework):
    if AgentUtils.isUpgradeProcess(Framework):
        if AgentUtils.isUpgradeByUDAgent(Framework):
            client = Framework.getConnectedClient()
            agentVersion = client.getVersion()
            logger.debug("The current agent version is:", agentVersion)

            connectedUDACredentialId = client.getCredentialId()
            logger.debug('Credential id on remote:', connectedUDACredentialId)

            installCredentialId = Framework.getParameter(
                AgentUtils.UDAGENT_CONNECT_CREDENTIAL_ID_PARAM)
            logger.debug('Credential id for upgrade:', installCredentialId)

            if not AgentUtils.versionsEqual(Framework, agentVersion) or (
                    installCredentialId
                    and installCredentialId != connectedUDACredentialId):
                logger.debug("Notice: The connected client is still old UDA.")
        errorCode = AgentUtils.getUpgradeErrorCode(Framework)
    else:
        errorCode = AgentUtils.getInstallErrorCode(Framework)
    if errorCode:
        if errorCode.isSuccess():
            Framework.setProperty(CheckAgentInstalled.FIRST_TRY_INSTALL_AGENT,
                                  CheckAgentInstalled.FIRST_TRY_INSTALL_AGENT)
            Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
        elif errorCode.isInProgress():
            logger.debug(
                'UDA install command is in progress, will check after parking')
            Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
        else:
            logger.debug(
                'Failed to install UDA according to install error code.')
            Framework.reportError("Install/Upgrade UDA failed. Reason is:%s" %
                                  errorCode.getMessage())
            Framework.setStepExecutionStatus(WorkflowStepStatus.FATAL_FAILURE)
    else:
        logger.debug('Can not get error code now, will check after parking')
        Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)