Search in sources :

Example 6 with JschSftpClient

use of com.axway.ats.core.ssh.JschSftpClient in project ats-framework by Axway.

the class AgentController method isAgentInstalled.

/**
     * Check whether the agent is installed or not. Currently are just checking
     * whether the agentapp.war file is existing on the right place.
     *
     * @param agentAlias the agent alias declared in the configuration
     * @return <code>true</code> if the ATS Agent is installed
     * @throws AtsManagerException
     */
private boolean isAgentInstalled(AbstractApplicationInfo agentInfo) throws AtsManagerException {
    JschSftpClient sftpClient = new JschSftpClient();
    try {
        sftpClient.connect(agentInfo.systemUser, agentInfo.systemPassword, agentInfo.host, agentInfo.sshPort, agentInfo.sshPrivateKey, agentInfo.sshPrivateKeyPassword);
        boolean isDeployed = sftpClient.isRemoteFileOrDirectoryExisting(agentInfo.getSftpHome() + "ats-agent/webapp/agentapp.war");
        log.info(agentInfo.getDescription() + " seems " + (isDeployed ? "" : "not") + " deployed in " + agentInfo.getSftpHome());
        return isDeployed;
    } finally {
        sftpClient.disconnect();
    }
}
Also used : JschSftpClient(com.axway.ats.core.ssh.JschSftpClient)

Aggregations

JschSftpClient (com.axway.ats.core.ssh.JschSftpClient)6 AtsManagerException (com.axway.ats.core.atsconfig.exceptions.AtsManagerException)4 AgentInfo (com.axway.ats.core.atsconfig.model.AgentInfo)3 PathInfo (com.axway.ats.core.atsconfig.model.PathInfo)3 ApplicationStatus (com.axway.ats.core.atsconfig.AtsInfrastructureManager.ApplicationStatus)1 File (java.io.File)1