Skip to content

Commit

Permalink
Merge pull request #13 from pjanouse/JENKINS-38366
Browse files Browse the repository at this point in the history
[JENKINS-38366] Use Mode.NORMAL when Label==NULL
  • Loading branch information
scoheb committed Oct 12, 2016
2 parents 650612d + e019669 commit 3918c6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/main/java/com/redhat/foreman/ForemanSharedNode.java
@@ -1,11 +1,11 @@
package com.redhat.foreman;

import hudson.Extension;
import hudson.model.Node;
import hudson.model.TaskListener;
import hudson.model.Descriptor.FormException;
import hudson.model.Queue.BuildableItem;
import hudson.model.queue.CauseOfBlockage;
import hudson.model.Node;
import hudson.model.Queue;
import hudson.slaves.AbstractCloudComputer;
import hudson.slaves.AbstractCloudSlave;
Expand Down Expand Up @@ -52,7 +52,7 @@ public void terminate() throws InterruptedException, IOException {
* @throws FormException if occurs.
* @throws IOException if occurs.
*/
public ForemanSharedNode(
public ForemanSharedNode(
String cloudName,
String name,
String description,
Expand All @@ -61,8 +61,11 @@ public ForemanSharedNode(
ComputerLauncher launcher,
RetentionStrategy<AbstractCloudComputer> strategy,
List<? extends NodeProperty<?>> nodeProperties) throws FormException, IOException {
//CS IGNORE check FOR NEXT 4 LINES. REASON: necessary inline conditional in super().
super(name, description, remoteFS, NUM_EXECUTORS,
Node.Mode.EXCLUSIVE, label, launcher, strategy, nodeProperties);
label == null ? Node.Mode.NORMAL : Node.Mode.EXCLUSIVE,
label, launcher, strategy, nodeProperties);
LOGGER.info("Instancing a new ForemanSharedNode: name='"+name+"', label='"+(label==null?"<NULL>":label.toString())+"'");
this.cloudName = cloudName;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/redhat/foreman/ForemanSharedNodeCloud.java
Expand Up @@ -2,6 +2,7 @@

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.Util;
import hudson.model.Computer;
import hudson.model.Descriptor;
import hudson.model.Label;
Expand Down Expand Up @@ -260,7 +261,7 @@ private ForemanSharedNode provision(Label label) throws Exception {
return null;
}

String labelsForHost = getForemanAPI().getLabelsForHost(reservedHostName);
String labelsForHost = Util.fixEmptyAndTrim(getForemanAPI().getLabelsForHost(reservedHostName));
String remoteFS = getForemanAPI().getRemoteFSForSlave(reservedHostName);
String hostIP = getForemanAPI().getIPForHost(reservedHostName);
String hostForConnection = reservedHostName;
Expand Down

0 comments on commit 3918c6c

Please sign in to comment.