Skip to content
Permalink
Browse files

[FIXED JENKINS-14120] fix confusing output

  • Loading branch information
imod committed Jun 24, 2012
1 parent eae0db0 commit 95366bbcbcb018483a62319e85462597c102dfe8
@@ -1,9 +1,15 @@
package org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger;

import static com.google.common.collect.Lists.transform;

import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

import hudson.EnvVars;
import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Hudson;
import hudson.model.Node;
import hudson.model.TaskListener;
@@ -14,6 +20,7 @@
import org.kohsuke.stapler.DataBoundConstructor;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

@@ -24,6 +31,12 @@
public final String name;
public final String nodeLabel;

private static final Function<Node, String> PROJECT_NAME_FUNCTION = new Function<Node, String>() {
public String apply(Node from) {
return from.getDisplayName();
}
};

@DataBoundConstructor
public AllNodesForLabelBuildParameterFactory(String name, String nodeLabel) {
this.name = name;
@@ -37,7 +50,8 @@ public AllNodesForLabelBuildParameterFactory(String name, String nodeLabel) {

listener.getLogger().println("Getting all nodes with label: " + labelExpanded);
Set<Node> nodes = Hudson.getInstance().getLabel(labelExpanded).getNodes();
listener.getLogger().println("Found nodes: " + String.valueOf(nodes));
List<String> nodeNames = Lists.transform(new ArrayList<Node>(nodes), PROJECT_NAME_FUNCTION);
listener.getLogger().println("Found nodes: " + String.valueOf(nodeNames));
List<AbstractBuildParameters> params = Lists.newArrayList();
if (nodes == null || nodes.isEmpty()) {
params.add(new NodeLabelBuildParameter(name, labelExpanded));

0 comments on commit 95366bb

Please sign in to comment.