From bae9180dd5602dbab3e1317dd2856269ee3ec94f Mon Sep 17 00:00:00 2001 From: Rita Norinho Date: Fri, 22 Dec 2023 12:34:28 +0000 Subject: [PATCH 1/2] Add logic to not call terminate when there are no versions to be terminated --- src/Common/Handlers/NewEnvironmentHandler.cs | 15 ++++++++++----- src/Version.props | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Common/Handlers/NewEnvironmentHandler.cs b/src/Common/Handlers/NewEnvironmentHandler.cs index d043e9c..691e7f1 100644 --- a/src/Common/Handlers/NewEnvironmentHandler.cs +++ b/src/Common/Handlers/NewEnvironmentHandler.cs @@ -127,13 +127,18 @@ bool terminateOtherVersionsRemoveVolumes terminateOperationAttibutes.Add(attributeRemove); terminateOperationAttibutes.Add(attributeRemoveVolumes); } + if (customerEnvironmentsToTerminate.Count > 0) + { + await _customerPortalClient.TerminateObjects, CustomerEnvironment>(customerEnvironmentsToTerminate, terminateOperationAttibutes); - await _customerPortalClient.TerminateObjects, CustomerEnvironment>(customerEnvironmentsToTerminate, terminateOperationAttibutes); - - // wait until they're terminated - await _environmentDeploymentHandler.WaitForEnvironmentsToBeTerminated(customerEnvironmentsToTerminate); + // wait until they're terminated + await _environmentDeploymentHandler.WaitForEnvironmentsToBeTerminated(customerEnvironmentsToTerminate); - Session.LogInformation("Other versions terminated!"); + Session.LogInformation("Other versions terminated!"); + } else + { + Session.LogInformation("There are no versions with a eligible status to be terminated."); + } } } // if not, check if we are creating a new environment for an infrastructure diff --git a/src/Version.props b/src/Version.props index 521f9b8..2690715 100644 --- a/src/Version.props +++ b/src/Version.props @@ -1,5 +1,5 @@ - 1.13.7 + 1.13.8 From 4e5813035ff64f700657f4bd8f5a4d05d3fa4b8d Mon Sep 17 00:00:00 2001 From: Rita Norinho Date: Fri, 22 Dec 2023 14:25:55 +0000 Subject: [PATCH 2/2] Fix typo --- src/Common/Handlers/NewEnvironmentHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common/Handlers/NewEnvironmentHandler.cs b/src/Common/Handlers/NewEnvironmentHandler.cs index 691e7f1..4574247 100644 --- a/src/Common/Handlers/NewEnvironmentHandler.cs +++ b/src/Common/Handlers/NewEnvironmentHandler.cs @@ -137,7 +137,7 @@ bool terminateOtherVersionsRemoveVolumes Session.LogInformation("Other versions terminated!"); } else { - Session.LogInformation("There are no versions with a eligible status to be terminated."); + Session.LogInformation("There are no versions with an eligible status to be terminated."); } } }