Skip to content

Commit

Permalink
Merge pull request #1008 from tuxy85/bugfix/aws-exception-error-code
Browse files Browse the repository at this point in the history
Reconnect to EC2 also when error code is ExpiredToken
  • Loading branch information
res0nance authored Nov 27, 2024
2 parents d4418d5 + 6638970 commit 01ac047
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/ec2/EC2Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,9 @@ public Collection<PlannedNode> provision(final Label label, int excessWorkload)
}
} catch (AmazonServiceException e) {
LOGGER.log(Level.WARNING, t + ". Exception during provisioning", e);
if (e.getErrorCode().equals("RequestExpired")) {
// JENKINS-71554: A RequestExpired error can indicate that credentials have expired so reconnect
LOGGER.log(Level.INFO, "[JENKINS-71554] Reconnecting to EC2 due to RequestExpired error");
if (e.getErrorCode().equals("RequestExpired") || e.getErrorCode().equals("ExpiredToken")) {
// A RequestExpired or ExpiredToken error can indicate that credentials have expired so reconnect
LOGGER.log(Level.INFO, "Reconnecting to EC2 due to RequestExpired or ExpiredToken error");
try {
reconnectToEc2();
} catch (IOException e2) {
Expand Down

0 comments on commit 01ac047

Please sign in to comment.