diff --git a/JenkinsWiki.adoc b/JenkinsWiki.adoc index 1220ca7..e67c00c 100644 --- a/JenkinsWiki.adoc +++ b/JenkinsWiki.adoc @@ -40,6 +40,11 @@ termination" [SpotinstPlugin-Versionhistory] == Version history +[SpotinstPlugin-Version2.2.19(May29,2024)] +=== Version 2.2.19 (May 29, 2024) + +* AWS stateful groups: removed support of all "false" values persistence + [SpotinstPlugin-Version2.2.18(May07,2024)] === Version 2.2.18 (May 07, 2024) diff --git a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java index b6ed9fe..cec6c8e 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java @@ -298,20 +298,7 @@ protected BlResponse checkIsStatefulGroup() { ApiResponse groupResponse = awsGroupRepo.getGroup(groupId, this.accountId); if (groupResponse.isRequestSucceed()) { - Boolean result = false; - AwsGroup awsGroup = groupResponse.getValue(); - AwsGroupStrategy groupStrategy = awsGroup.getStrategy(); - - if (groupStrategy != null) { - AwsGroupPersistence groupPersistence = groupStrategy.getPersistence(); - - if (groupPersistence != null) { - result = BooleanUtils.isTrue(groupPersistence.getShouldPersistPrivateIp()) || - BooleanUtils.isTrue(groupPersistence.getShouldPersistBlockDevices()) || - BooleanUtils.isTrue(groupPersistence.getShouldPersistRootDevice()) || - StringUtils.isNotEmpty(groupPersistence.getBlockDevicesMode()); - } - } + Boolean result = computeIfStatefulFromResponse(groupResponse); retVal = new BlResponse<>(result); } @@ -323,6 +310,24 @@ protected BlResponse checkIsStatefulGroup() { return retVal; } + private static Boolean computeIfStatefulFromResponse(ApiResponse groupResponse) { + boolean retVal = false; + AwsGroup awsGroup = groupResponse.getValue(); + AwsGroupStrategy groupStrategy = awsGroup.getStrategy(); + + if (groupStrategy != null) { + AwsGroupPersistence groupPersistence = groupStrategy.getPersistence(); + + if (groupPersistence != null) { + retVal = BooleanUtils.isTrue(groupPersistence.getShouldPersistPrivateIp()) || + BooleanUtils.isTrue(groupPersistence.getShouldPersistBlockDevices()) || + BooleanUtils.isTrue(groupPersistence.getShouldPersistRootDevice()); + } + } + + return retVal; + } + private void syncGroupStatefulInstances() { IAwsGroupRepo awsGroupRepo = RepoManager.getInstance().getAwsGroupRepo(); ApiResponse> statefulInstancesResponse =