diff --git a/pom.xml b/pom.xml
index 733bc8c8..05a0e984 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.jenkins-ci.plugins
plugin
- 2.22
+ 2.29
vsphere-cloud
@@ -32,14 +32,14 @@
A business-friendly OSS license
-
+
scm:git:https://github.com/jenkinsci/vsphere-cloud-plugin.git
scm:git:https://git@github.com/jenkinsci/vsphere-cloud-plugin.git
https://github.com/jenkinsci/vsphere-cloud-plugin
HEAD
-
-
+
+
UTF-8
@@ -58,7 +58,7 @@
http://repo.jenkins-ci.org/public/
-
+
org.kohsuke.stapler
@@ -106,7 +106,7 @@
org.jenkins-ci.tools
maven-hpi-plugin
- true
+ false
diff --git a/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java b/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java
index 5bc448e9..746107ee 100644
--- a/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java
+++ b/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package org.jenkinsci.plugins;
import hudson.Util;
@@ -66,20 +62,30 @@ public vSphereCloudLauncher(ComputerLauncher launcher,
this.waitForVMTools = waitForVMTools;
this.snapName = snapName;
this.launchDelay = Util.tryParseNumber(launchDelay, 60).intValue();
- if ("Shutdown".equals(idleOption)) {
- idleAction = MACHINE_ACTION.SHUTDOWN;
- } else if ("Shutdown and Revert".equals(idleOption)) {
- idleAction = MACHINE_ACTION.REVERT;
- } else if ("Revert and Restart".equals(idleOption)) {
- idleAction = MACHINE_ACTION.REVERT_AND_RESTART;
- } else if ("Revert and Reset".equals(idleOption)) {
- idleAction = MACHINE_ACTION.REVERT_AND_RESET;
- } else if ("Reset".equals(idleOption)) {
- idleAction = MACHINE_ACTION.RESET;
- } else if ("Suspend".equals(idleOption)) {
- idleAction = MACHINE_ACTION.SUSPEND;
- } else {
+ if (null == idleOption) {
idleAction = MACHINE_ACTION.NOTHING;
+ } else switch (idleOption) {
+ case "Shutdown":
+ idleAction = MACHINE_ACTION.SHUTDOWN;
+ break;
+ case "Shutdown and Revert":
+ idleAction = MACHINE_ACTION.REVERT;
+ break;
+ case "Revert and Restart":
+ idleAction = MACHINE_ACTION.REVERT_AND_RESTART;
+ break;
+ case "Revert and Reset":
+ idleAction = MACHINE_ACTION.REVERT_AND_RESET;
+ break;
+ case "Reset":
+ idleAction = MACHINE_ACTION.RESET;
+ break;
+ case "Suspend":
+ idleAction = MACHINE_ACTION.SUSPEND;
+ break;
+ default:
+ idleAction = MACHINE_ACTION.NOTHING;
+ break;
}
this.LimitedTestRunCount = Util.tryParseNumber(LimitedTestRunCount, 0).intValue();
}
@@ -336,19 +342,25 @@ public synchronized void afterDisconnect(SlaveComputer slaveComputer, TaskListen
case NOTHING:
break;
}
- if (localIdle == MACHINE_ACTION.REVERT) {
- revertVM(vm, vsC, slaveComputer, taskListener);
- } else if (localIdle == MACHINE_ACTION.REVERT_AND_RESTART) {
- revertVM(vm, vsC, slaveComputer, taskListener);
- if (power == VirtualMachinePowerState.poweredOn) {
- // Some time is needed for the VMWare Tools to reactivate
- Thread.sleep(60000);
- shutdownVM(vm, slaveComputer, taskListener);
- }
- powerOnVM(vm, slaveComputer, taskListener);
- } else if (localIdle == MACHINE_ACTION.REVERT_AND_RESET) {
- revertVM(vm, vsC, slaveComputer, taskListener);
- resetVM(vm, slaveComputer, taskListener);
+ switch (localIdle) {
+ case REVERT:
+ revertVM(vm, vsC, slaveComputer, taskListener);
+ break;
+ case REVERT_AND_RESTART:
+ revertVM(vm, vsC, slaveComputer, taskListener);
+ if (power == VirtualMachinePowerState.poweredOn) {
+ // Some time is needed for the VMWare Tools to reactivate
+ Thread.sleep(60000);
+ shutdownVM(vm, slaveComputer, taskListener);
+ }
+ powerOnVM(vm, slaveComputer, taskListener);
+ break;
+ case REVERT_AND_RESET:
+ revertVM(vm, vsC, slaveComputer, taskListener);
+ resetVM(vm, slaveComputer, taskListener);
+ break;
+ default:
+ break;
}
} else {
// VM is already powered down.
diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java b/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java
index dd3acd1e..ca7993a7 100644
--- a/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java
+++ b/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java
@@ -15,7 +15,6 @@
package org.jenkinsci.plugins.vsphere.builders;
import hudson.*;
-import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.model.Run;
diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java b/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java
index 8ea98493..1337cf87 100644
--- a/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java
+++ b/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java
@@ -123,7 +123,7 @@ private boolean hasFiniteCapacity() {
private double calcFullness() {
final int maxToProvision = calcMaxToProvision();
- return ((double) calcCurrentCommitment()) / (double) maxToProvision;
+ return calcCurrentCommitment() / (double) maxToProvision;
}
boolean hasCapacityForMore() {
diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly
index d147e4cb..cc069743 100644
--- a/src/main/resources/index.jelly
+++ b/src/main/resources/index.jelly
@@ -1,3 +1,4 @@
+
diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly
index e8d5b4c6..7ce3d623 100644
--- a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly
+++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly
@@ -1,3 +1,4 @@
+
diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly
index eed912e5..a5110ed6 100644
--- a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly
+++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly
@@ -1,3 +1,4 @@
+
diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly
index 660d38ad..59fd6709 100644
--- a/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly
+++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly
@@ -1,3 +1,4 @@
+
diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly
index 60afad70..036bbb48 100644
--- a/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly
+++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly
@@ -1,6 +1,7 @@
+
-
+