From 66389700cd77fa10aeced42a652cd6715a5b5669 Mon Sep 17 00:00:00 2001 From: Salvo Marino Date: Fri, 22 Nov 2024 22:11:17 +0000 Subject: [PATCH] Reconnect to EC2 also when error code is ExpiredToken --- src/main/java/hudson/plugins/ec2/EC2Cloud.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/hudson/plugins/ec2/EC2Cloud.java b/src/main/java/hudson/plugins/ec2/EC2Cloud.java index 138a94179..8b9de5da0 100644 --- a/src/main/java/hudson/plugins/ec2/EC2Cloud.java +++ b/src/main/java/hudson/plugins/ec2/EC2Cloud.java @@ -778,9 +778,9 @@ public Collection provision(final Label label, int excessWorkload) if (excessWorkload == 0) break; } 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) {