Skip to content

Commit

Permalink
Code cleanup (#102)
Browse files Browse the repository at this point in the history
* Reformat pom.xml
* Use HTTPS for Jenkins repository
* Replace deprecated TimeUnit2
* Remove unnecessary semicolon in Groovy code
* Properly use <br> element in HTML
* Fix numerous typos
  • Loading branch information
darxriggs authored and pjdarton committed Mar 8, 2019
1 parent dbd95da commit e878d86
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 36 deletions.
50 changes: 26 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
Expand All @@ -9,9 +11,19 @@
<artifactId>vsphere-cloud</artifactId>
<version>2.20-SNAPSHOT</version>
<packaging>hpi</packaging>

<name>vSphere Plugin</name>
<description>Integrates Jenkins with a vSphere server</description>
<url>https://wiki.jenkins-ci.org/display/JENKINS/vSphere+Cloud+Plugin</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>

<developers>
<developer>
<id>jswager</id>
Expand All @@ -24,14 +36,6 @@
<email>[email protected]</email>
</developer>
</developers>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/jenkinsci/vsphere-cloud-plugin.git</connection>
Expand All @@ -44,21 +48,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<name>Jenkins Repository</name>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>org.kohsuke.stapler</groupId>
Expand Down Expand Up @@ -100,6 +89,19 @@
</dependency>
</dependencies>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jenkinsci/plugins/vSphereCloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public Collection<PlannedNode> provision(final Label label, int excessWorkload)
excessWorkloadSoFar -= numberOfvSphereCloudSlaveExecutors;
if (excessWorkloadSoFar <= 0) {
VSLOG.log(Level.INFO, methodCallDescription + ": " + numberOfvSphereCloudSlaves + " existing slaves (="
+ numberOfvSphereCloudSlaveExecutors + " executors): Workload is satisifed by bringing those online.");
+ numberOfvSphereCloudSlaveExecutors + " executors): Workload is satisfied by bringing those online.");
return Collections.emptySet();
}
// If we've got this far then our static slaves are insufficient to meet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import hudson.slaves.CloudRetentionStrategy;
import hudson.slaves.EphemeralNode;
import hudson.slaves.RetentionStrategy;
import hudson.util.TimeUnit2;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -60,7 +60,7 @@ public int getIdleMinutes() {
public long check(final AbstractCloudComputer c) {
if (c.isIdle() && !disabled) {
final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds();
if (idleMilliseconds > TimeUnit2.MINUTES.toMillis(idleMinutes)) {
if (idleMilliseconds > TimeUnit.MINUTES.toMillis(idleMinutes)) {
LOGGER.log(
Level.FINE,
"Disconnecting {0} because it has been idle for more than {1} minutes (has been idle for {2}ms)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private VirtualDeviceConfigSpec createAddDiskConfigSpec(
if (m.matches()) {
diskNames.put(m.group(1), true);
} else {
VSphereLogger.vsLogger(jLogger, String.format("Warning: unreconnized disk filename format: %s", info.getFileName()));
VSphereLogger.vsLogger(jLogger, String.format("Warning: unrecognized disk filename format: %s", info.getFileName()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div>
Uses the vSphere "GuestInfo" data object to pass information to the newly-cloned virtual machine.
The guest operating system can retrieve this information using the <tt>vmtoolsd</tt> utility.
<br></br>
<br>
e.g. Passing in a GuestInfo property named
"<tt>JNLPURL</tt>"
with value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<li>If you use the run-once strategy, you should ensure that there is only 1 executor.</li>
<li>If you use the keep-until-idle strategy, you should ensure that "disconnect after limited builds" is disabled (set to 0).</li>
</ul>
Both these otions have an idle timeout (in minutes) after which to kill the slave, but for a run-once strategy, this is only a fail-safe if the slave fails to connect.
Both these options have an idle timeout (in minutes) after which to kill the slave, but for a run-once strategy, this is only a fail-safe if the slave fails to connect.
Normally a run-once slave will be terminated immediately after it has completed its one-and-only job.
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jenkinsci.plugins.vsphere.VSphereConnectionConfig;
package org.jenkinsci.plugins.vsphere.VSphereConnectionConfig

f = namespace(lib.FormTagLib)
c = namespace(lib.CredentialsTagLib)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ private void findTemplateWithMostFreeCapacityGivenUnequalCapsThenDistributesTheL
}

@Test
public void findTemplateWithMostFreeCapacityGivenOneCappedAndOneUncappedThenDistributesTheLoadEventlyUntilCapReached() {
findTemplateWithMostFreeCapacityGivenDifferentCapnessThenDistributesTheLoadEventlyUntilCapReached(true);
public void findTemplateWithMostFreeCapacityGivenOneCappedAndOneUncappedThenDistributesTheLoadEvenlyUntilCapReached() {
findTemplateWithMostFreeCapacityGivenDifferentCapnessThenDistributesTheLoadEvenlyUntilCapReached(true);
}

@Test
public void findTemplateWithMostFreeCapacityGivenOneUncappedAndOneCappedThenDistributesTheLoadEventlyUntilCapReached() {
findTemplateWithMostFreeCapacityGivenDifferentCapnessThenDistributesTheLoadEventlyUntilCapReached(false);
public void findTemplateWithMostFreeCapacityGivenOneUncappedAndOneCappedThenDistributesTheLoadEvenlyUntilCapReached() {
findTemplateWithMostFreeCapacityGivenDifferentCapnessThenDistributesTheLoadEvenlyUntilCapReached(false);
}

private void findTemplateWithMostFreeCapacityGivenDifferentCapnessThenDistributesTheLoadEventlyUntilCapReached(
private void findTemplateWithMostFreeCapacityGivenDifferentCapnessThenDistributesTheLoadEvenlyUntilCapReached(
boolean forwards) {
// Given
final CloudProvisioningRecord capOf2 = createInstance(2, 0, 0);
Expand Down

0 comments on commit e878d86

Please sign in to comment.