Search in sources :

Example 1 with CommandLauncher

use of hudson.slaves.CommandLauncher in project vsphere-cloud-plugin by jenkinsci.

the class vSphereCloudSlaveTemplate method determineLauncher.

private ComputerLauncher determineLauncher(final VSphere vSphere, final String cloneName) throws VSphereException {
    if (launcher instanceof JNLPLauncher) {
        return launcher;
    }
    if (launcher instanceof CommandLauncher) {
        return launcher;
    }
    if (launcher instanceof SSHLauncher) {
        final SSHLauncher sshLauncher = (SSHLauncher) launcher;
        LOGGER.log(Level.FINER, "Slave {0} uses SSHLauncher - obtaining IP address...", cloneName);
        final String ip = vSphere.getIp(vSphere.getVmByName(cloneName), 1000);
        LOGGER.log(Level.FINER, "Slave {0} has IP address {1}", new Object[] { cloneName, ip });
        final SSHLauncher launcherWithIPAddress = new SSHLauncher(ip, sshLauncher.getPort(), sshLauncher.getCredentialsId(), sshLauncher.getJvmOptions(), sshLauncher.getJavaPath(), sshLauncher.getPrefixStartSlaveCmd(), sshLauncher.getSuffixStartSlaveCmd(), sshLauncher.getLaunchTimeoutSeconds(), sshLauncher.getMaxNumRetries(), sshLauncher.getRetryWaitTime());
        return launcherWithIPAddress;
    }
    throw new IllegalStateException("Unsupported launcher (" + launcher + ") in template configuration");
}
Also used : CommandLauncher(hudson.slaves.CommandLauncher) SSHLauncher(hudson.plugins.sshslaves.SSHLauncher) JNLPLauncher(hudson.slaves.JNLPLauncher)

Aggregations

SSHLauncher (hudson.plugins.sshslaves.SSHLauncher)1 CommandLauncher (hudson.slaves.CommandLauncher)1 JNLPLauncher (hudson.slaves.JNLPLauncher)1