Skip to content

Commit

Permalink
fix(cloudformation): Support Cloudformation templates as lists (#3270) (
Browse files Browse the repository at this point in the history
#3277)

Something has changed between Spinnaker 1.15.6 and 1.16.0 with regard to how Cloudformation templates entered into the inline editor in Deck are parsed. Updating Orca to account for this change.
  • Loading branch information
spinnakerbot authored and Travis Tomsu committed Nov 11, 2019
1 parent 22ab949 commit ed38c00
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -108,6 +109,11 @@ public TaskResult execute(@Nonnull Stage stage) {
if (templateBody instanceof Map && !((Map) templateBody).isEmpty()) {
templateBody = new Yaml().dump(templateBody);
task.put("templateBody", templateBody);
} else if (templateBody instanceof List && !((List) templateBody).isEmpty()) {
templateBody =
((List<?>) templateBody)
.stream().map(part -> new Yaml().dump(part)).collect(Collectors.joining("\n---\n"));
task.put("templateBody", templateBody);
}
if (!(templateBody instanceof String) || Strings.isNullOrEmpty((String) templateBody)) {
throw new IllegalArgumentException(
Expand Down

0 comments on commit ed38c00

Please sign in to comment.