From cfaf163d875d7187c421dd66ff3437e8a83b6ed5 Mon Sep 17 00:00:00 2001 From: Justin Field <fieldju@gmail.com> Date: Fri, 31 Mar 2017 20:12:17 -0700 Subject: [PATCH] Fixing bad status checking logic (#28) --- gradle.properties | 2 +- .../nike/cerberus/operation/core/UpdateStackOperation.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 985fdd2e..b9171128 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,4 +16,4 @@ group=com.nike artifactId=cerberus-lifecycle-cli -version=0.16.2 +version=0.16.3 diff --git a/src/main/java/com/nike/cerberus/operation/core/UpdateStackOperation.java b/src/main/java/com/nike/cerberus/operation/core/UpdateStackOperation.java index e4f9e209..2e5669b9 100644 --- a/src/main/java/com/nike/cerberus/operation/core/UpdateStackOperation.java +++ b/src/main/java/com/nike/cerberus/operation/core/UpdateStackOperation.java @@ -20,6 +20,7 @@ import com.amazonaws.services.cloudformation.model.StackStatus; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Sets; import com.nike.cerberus.ConfigConstants; import com.nike.cerberus.command.core.UpdateStackCommand; @@ -44,6 +45,7 @@ import javax.inject.Inject; import javax.inject.Named; import java.util.HashMap; +import java.util.List; import java.util.Map; import static com.amazonaws.services.cloudformation.model.StackStatus.*; @@ -128,8 +130,8 @@ public void run(final UpdateStackCommand command) { UPDATE_ROLLBACK_FAILED )); - if (endStatus != UPDATE_COMPLETE || endStatus != UPDATE_COMPLETE_CLEANUP_IN_PROGRESS) { - final String errorMessage = String.format("Unexpected end status: %s", endStatus.name()); + if (! ImmutableList.of(UPDATE_COMPLETE, UPDATE_COMPLETE_CLEANUP_IN_PROGRESS).contains(endStatus)) { + final String errorMessage = String.format("CloudFormation reports that updating the stack was not successful. end status: %s", endStatus.name()); logger.error(errorMessage); throw new UnexpectedCloudFormationStatusException(errorMessage);