Skip to content

Commit

Permalink
JENKINS-33945 allow node provisioning when existing matching node is …
Browse files Browse the repository at this point in the history
…offline

You can not provision a new node when an existing node from the template
is marked offline.  This change consults isOffline() to allow new node
provisioning.  Nodes can either be offline due to channel errors or user
interaction.  Either way, don't block new nodes.
  • Loading branch information
tjbaker committed Mar 31, 2016
1 parent e3bfb31 commit 8226bdb
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/java/hudson/plugins/ec2/SlaveTemplate.java
@@ -1,16 +1,16 @@
/*
* The MIT License
*
*
* Copyright (c) 2004-, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of other of contributors
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
* Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
Expand Down Expand Up @@ -404,7 +404,12 @@ private boolean checkInstance(PrintStream logger, Instance existingInstance, EC2
if (!node.toComputer().isPartiallyIdle()) {
logProvision(logger, " false - Node is not partially idle");
return false;
} else {
}
else if (node.toComputer().isOffline()) {
logProvision(logger, " false - Node is offline");
return false;
}
else {
logProvision(logger, " true - Node has capacity - can use it");
returnNode[0] = node;
return true;
Expand Down Expand Up @@ -823,7 +828,7 @@ private KeyPair getKeyPair(AmazonEC2 ec2) throws IOException, AmazonClientExcept
/**
* Update the tags stored in EC2 with the specified information. Re-try 5 times if instances isn't up by
* catchErrorCode - e.g. InvalidSpotInstanceRequestID.NotFound or InvalidInstanceRequestID.NotFound
*
*
* @param ec2
* @param inst_tags
* @param catchErrorCode
Expand Down Expand Up @@ -1111,7 +1116,7 @@ private ArrayList<String> getAvailabilityZones(AmazonEC2 ec2) {

/**
* Populates the Bid Type Drop down on the slave template config.
*
*
* @return
*/
public ListBoxModel doFillBidTypeItems() {
Expand Down

0 comments on commit 8226bdb

Please sign in to comment.