use of org.jenkinsci.plugins.vsphere.RunOnceCloudRetentionStrategy in project vsphere-cloud-plugin by jenkinsci.
the class vSphereCloudSlaveTemplate method readResolve.
protected Object readResolve() {
this.labelSet = Label.parse(labelString);
if (this.templateInstanceCap == 0) {
this.templateInstanceCap = Integer.MAX_VALUE;
}
if (this.useSnapshot == null) {
this.useSnapshot = Boolean.valueOf(this.snapshotName != null);
}
/*
* If we've upgraded from an earlier version of the plugin
* where things were hard-coded instead of configurable
* then we'll need to transfer the data across to the new
* format.
*/
if (this.launcher == null) {
LOGGER.log(Level.CONFIG, "{0} loaded old configuration that had hard-coded SSHLauncher.", this);
try {
final String oldCredentialsIdOrNull = getCredentialsId();
final String oldCredentialsId = oldCredentialsIdOrNull == null ? "" : oldCredentialsIdOrNull;
// these were the old hard-coded settings
this.launcher = new SSHLauncher(null, 0, oldCredentialsId, null, null, null, null, this.launchDelay, 3, 60);
LOGGER.log(Level.CONFIG, " - now configured to use {0}(..., {1}, ...)", new Object[] { this.launcher.getClass().getSimpleName(), oldCredentialsId });
} catch (Exception ex) {
LOGGER.log(Level.CONFIG, " - Failed to reconfigure launcher", ex);
}
}
if (this.retentionStrategy == null) {
LOGGER.log(Level.CONFIG, "{0} loaded old configuration that had hard-coded RunOnceCloudRetentionStrategy.", this);
try {
// these were the old hard-coded settings
final int oldTimeout = 2;
this.retentionStrategy = new RunOnceCloudRetentionStrategy(oldTimeout);
LOGGER.log(Level.CONFIG, " - now configured to use {0}({1})", new Object[] { this.retentionStrategy.getClass().getSimpleName(), oldTimeout });
} catch (Exception ex) {
LOGGER.log(Level.CONFIG, " - Failed to reconfigure strategy", ex);
}
}
return this;
}
use of org.jenkinsci.plugins.vsphere.RunOnceCloudRetentionStrategy in project vsphere-cloud-plugin by jenkinsci.
the class vSphereCloudSlaveTemplate method determineRetention.
private RetentionStrategy<?> determineRetention() {
if (retentionStrategy instanceof RunOnceCloudRetentionStrategy) {
final RunOnceCloudRetentionStrategy templateStrategy = (RunOnceCloudRetentionStrategy) retentionStrategy;
final RunOnceCloudRetentionStrategy cloneStrategy = new RunOnceCloudRetentionStrategy(templateStrategy.getIdleMinutes());
return cloneStrategy;
}
if (retentionStrategy instanceof VSphereCloudRetentionStrategy) {
final VSphereCloudRetentionStrategy templateStrategy = (VSphereCloudRetentionStrategy) retentionStrategy;
final VSphereCloudRetentionStrategy cloneStrategy = new VSphereCloudRetentionStrategy(templateStrategy.getIdleMinutes());
return cloneStrategy;
}
throw new IllegalStateException("Unsupported retentionStrategy (" + retentionStrategy + ") in template configuration");
}
Aggregations