-
-
Notifications
You must be signed in to change notification settings - Fork 103
Minor fixes for adding timeOutInSeconds to Clone and Deploy by MarcelMue #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
95b0fbd
e6c6be0
cafd43a
a09b93b
b7625c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,8 @@ | |
|
|
||
| public class Clone extends VSphereBuildStep { | ||
|
|
||
| private final int TIMEOUT_DEFAULT = 60; | ||
|
|
||
| private final String sourceName; | ||
| private final String clone; | ||
| private final boolean linkedClone; | ||
|
|
@@ -51,12 +53,13 @@ public class Clone extends VSphereBuildStep { | |
| private final String folder; | ||
| private final String customizationSpec; | ||
| private final boolean powerOn; | ||
| private final int timeoutInSeconds; | ||
| private String IP; | ||
|
|
||
| @DataBoundConstructor | ||
| public Clone(String sourceName, String clone, boolean linkedClone, | ||
| String resourcePool, String cluster, String datastore, String folder, | ||
| boolean powerOn, String customizationSpec) throws VSphereException { | ||
| boolean powerOn, int timeoutInSeconds, String customizationSpec) throws VSphereException { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "int" should be "Integer" in order to cope with old configuration data where this parameter did not exist. |
||
| this.sourceName = sourceName; | ||
| this.clone = clone; | ||
| this.linkedClone = linkedClone; | ||
|
|
@@ -66,6 +69,12 @@ public Clone(String sourceName, String clone, boolean linkedClone, | |
| this.folder=folder; | ||
| this.customizationSpec=customizationSpec; | ||
| this.powerOn=powerOn; | ||
| if (timeoutInSeconds != null) { | ||
| this.timeoutInSeconds = timeoutInSeconds; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once the timeoutInSeconds is an Integer, you should use ... = timeoutInSeconds.intValue(); to explicitly un-box the value. |
||
| } | ||
| else { | ||
| this.timeoutInSeconds = TIMEOUT_DEFAULT; | ||
| } | ||
| } | ||
|
|
||
| public String getSourceName() { | ||
|
|
@@ -103,6 +112,10 @@ public String getCustomizationSpec() { | |
| public boolean isPowerOn() { | ||
| return powerOn; | ||
| } | ||
|
|
||
| public int getTimeoutInSeconds() { | ||
| return timeoutInSeconds; | ||
| } | ||
|
|
||
| @Override | ||
| public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath filePath, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException { | ||
|
|
@@ -168,8 +181,8 @@ private boolean cloneFromSource(final Run<?, ?> run, final Launcher launcher, fi | |
| vsphere.cloneVm(expandedClone, expandedSource, linkedClone, expandedResourcePool, expandedCluster, | ||
| expandedDatastore, expandedFolder, powerOn, expandedCustomizationSpec, jLogger); | ||
| if (powerOn) { | ||
| VSphereLogger.vsLogger(jLogger,"Powering on VM..."); | ||
| IP = vsphere.getIp(vsphere.getVmByName(expandedClone), 60); | ||
| VSphereLogger.vsLogger(jLogger, "Powering on VM \""+expandedClone+"\" for the next "+timeoutInSeconds+" seconds."); | ||
| IP = vsphere.getIp(vsphere.getVmByName(expandedClone), timeoutInSeconds); | ||
| } | ||
| VSphereLogger.vsLogger(jLogger, "\""+expandedClone+"\" successfully cloned " + (powerOn ? "and powered on" : "") + "!"); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation incorrect - use spaces, not tabs (tabs are evil - they never display the same as some people set them to 4, some 2, some 8 etc).
There's indentation issues lower down too - check your editor's settings and ensure that the file is free of tabs (and then check the indentation again) before re-uploading.