Skip to content

Commit

Permalink
JENKINS-19500 Fix: Remove slave from Jenkins even when instance termi…
Browse files Browse the repository at this point in the history
…nation fails

Since we assume that the Spot request is no longer valid if an AmazonClientException/AmazonServiceException occurs
  • Loading branch information
Matt Riddle committed Sep 12, 2013
1 parent 53d256a commit 11693e7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/hudson/plugins/ec2/EC2SpotSlave.java
Expand Up @@ -69,18 +69,20 @@ public void terminate() {
}

}
Hudson.getInstance().removeNode(this);


} catch (AmazonServiceException e){
// Spot request is no longer valid
LOGGER.log(Level.WARNING, "Failed to terminated instance and cancel Spot request: " + spotInstanceRequestId);
} catch (AmazonClientException e){
// Spot request is no longer valid
LOGGER.log(Level.WARNING, "Failed to terminated instance and cancel Spot request: " + spotInstanceRequestId);
} catch(IOException e){
LOGGER.log(Level.WARNING,"Failed to remove slave: "+name, e);
}

try{
Hudson.getInstance().removeNode(this);
} catch (IOException e){
LOGGER.log(Level.WARNING,"Failed to remove slave: "+name, e);
}
}

/**
Expand Down

0 comments on commit 11693e7

Please sign in to comment.