Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Foster2015-05-13 15:10:16 -0400
committerBob Foster2015-05-13 15:10:16 -0400
commit3dd7e5695eee197d9e5e4d91104ad690c6e56666 (patch)
tree73cc3a9f1903edb01c993da09f6c842adf624d5c
parent0ec373a88ef1079e2f233adf47aaa036362c9cf6 (diff)
downloadorg.eclipse.hudson.core-3dd7e5695eee197d9e5e4d91104ad690c6e56666.tar.gz
org.eclipse.hudson.core-3dd7e5695eee197d9e5e4d91104ad690c6e56666.tar.xz
org.eclipse.hudson.core-3dd7e5695eee197d9e5e4d91104ad690c6e56666.zip
Fix Bug 467144 - Dynamically created slaves don't belong to any team
-rw-r--r--hudson-core/src/main/java/hudson/slaves/AbstractCloudSlave.java6
-rw-r--r--hudson-core/src/main/java/hudson/slaves/NodeProvisioner.java11
2 files changed, 15 insertions, 2 deletions
diff --git a/hudson-core/src/main/java/hudson/slaves/AbstractCloudSlave.java b/hudson-core/src/main/java/hudson/slaves/AbstractCloudSlave.java
index 4fffb896..82ca40ac 100644
--- a/hudson-core/src/main/java/hudson/slaves/AbstractCloudSlave.java
+++ b/hudson-core/src/main/java/hudson/slaves/AbstractCloudSlave.java
@@ -57,7 +57,11 @@ public abstract class AbstractCloudSlave extends Slave {
_terminate(new StreamTaskListener(System.out, Charset.defaultCharset()));
} finally {
try {
- Hudson.getInstance().removeNode(this);
+ Hudson hudson = Hudson.getInstance();
+ hudson.removeNode(this);
+ if (hudson.isTeamManagementEnabled()) {
+ hudson.getTeamManager().removeNode(getNodeName());
+ }
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to remove " + name, e);
}
diff --git a/hudson-core/src/main/java/hudson/slaves/NodeProvisioner.java b/hudson-core/src/main/java/hudson/slaves/NodeProvisioner.java
index 3260f5dd..20d397d2 100644
--- a/hudson-core/src/main/java/hudson/slaves/NodeProvisioner.java
+++ b/hudson-core/src/main/java/hudson/slaves/NodeProvisioner.java
@@ -123,7 +123,16 @@ public class NodeProvisioner {
PlannedNode f = itr.next();
if (f.future.isDone()) {
try {
- hudson.addNode(f.future.get());
+ Node node = f.future.get();
+ // Add to public team
+ hudson.addNode(node);
+ if (hudson.isTeamManagementEnabled()) {
+ try {
+ hudson.getTeamManager().addNode(null, node.getNodeName());
+ } catch (Exception e) {
+ LOGGER.log(Level.SEVERE, "Node cannot be added to public team", e);
+ }
+ }
LOGGER.info(f.displayName + " provisioning successfully completed. We have now " + hudson.getComputers().length + " computer(s)");
} catch (InterruptedException e) {
throw new AssertionError(e); // since we confirmed that the future is already done

Back to the top