Skip to content

Commit

Permalink
[JENKINS-31055] The intent of Node.save() is a no-op when not in Jenk…
Browse files Browse the repository at this point in the history
…ins list of nodes
  • Loading branch information
stephenc committed Oct 21, 2015
1 parent db37c76 commit 8e24f69
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/main/java/hudson/model/Node.java
Expand Up @@ -123,6 +123,12 @@ public boolean isHoldOffLaunchUntilSave() {
*/
@Override
public void save() throws IOException {
// this should be a no-op unless this node instance is the node instance in Jenkins' list of nodes
// thus where Jenkins.getInstance() == null there is no list of nodes, so we do a no-op
// Nodes.updateNode(n) will only persist the node record if the node instance is in the list of nodes
// so either path results in the same behaviour: the node instance is only saved if it is in the list of nodes
// for all other cases we do not know where to persist the node record and hence we follow the default
// no-op of a Saveable.NOOP
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins != null) {
jenkins.updateNode(this);
Expand Down

0 comments on commit 8e24f69

Please sign in to comment.