Skip to content
Permalink
Browse files
Merge pull request #27 from jenkinsci/ephemeral
[JENKINS-22639] Don't record changes to AbstractCloudSlaves or Ephemeral Nodes
  • Loading branch information
Stefan Brausch committed Sep 25, 2014
2 parents ba17eff + e410332 commit e9c4b003463a7aff44b71eee5560858bfb70520f
Showing with 15 additions and 4 deletions.
  1. +15 −4 src/main/java/hudson/plugins/jobConfigHistory/ComputerHistoryListener.java
@@ -5,6 +5,8 @@
package hudson.plugins.jobConfigHistory;

import hudson.Extension;
import hudson.slaves.EphemeralNode;
import hudson.slaves.AbstractCloudSlave;
import hudson.slaves.ComputerListener;
import hudson.model.Node;
import hudson.model.Slave;
@@ -49,19 +51,28 @@ public void onConfigurationChange() {
*/
private void onAdd() {
for (Node node : Jenkins.getInstance().getNodes()) {
if (!nodes.contains(node)) {
if (!nodes.contains(node) && isTracked(node)) {
switchHistoryDao(node).createNewNode(node);
return;
}
}
}

/**
* Is this node likely to be important to the user?
* @param node
*/
private boolean isTracked(Node node) {
return node != null &&
! (node instanceof AbstractCloudSlave || node instanceof EphemeralNode);
}

/**
* If a slave get removed.
*/
private void onRemove() {
for (Node node : nodes) {
if (!Jenkins.getInstance().getNodes().contains(node)) {
if (!Jenkins.getInstance().getNodes().contains(node) && isTracked(node)) {
switchHistoryDao(node).deleteNode(node);
return;
}
@@ -87,7 +98,7 @@ private void onChange() {
private void onRename() {
Node originalNode = null;
for (Node node : nodes) {
if (!Jenkins.getInstance().getNodes().contains(node)) {
if (!Jenkins.getInstance().getNodes().contains(node) && isTracked(node)) {
originalNode = node;
}
}
@@ -97,7 +108,7 @@ private void onRename() {
}
Node newNode = null;
for (Node node : Jenkins.getInstance().getNodes()) {
if (!nodes.contains(node)) {
if (!nodes.contains(node) && isTracked(node)) {
newNode = node;
}
}

0 comments on commit e9c4b00

Please sign in to comment.