zalando-stups / senza

Deploy immutable application stacks and create and execute AWS CloudFormation templates in a sane way
https://pypi.python.org/pypi/stups-senza
Other
96 stars 71 forks source link

Fix zero instances for SuccessRequires in AutoScalingGroups #537

Closed nolar closed 5 years ago

nolar commented 5 years ago

When the SuccessRequires is 0 of int type, the check does not as expected, and returns "1" for the CloudFormation. When the "0" of str type is used, it works fine. Because if 0 is false, while if "0" is true.

As a result, the formations with 0 expected instances in start fail to create when in the AWS, because it expects at least 1:

      AutoScaling:
        Minimum: 0
        Maximum: 1
        DesiredCapacity: 0
        SuccessRequires: 0     # <== fails
        SuccessRequires: "0"   # <== works

This fix makes the check more specific, and the only assumed "absent" value could be None here (despite this case is not mentioned in the tests at all, and not present anywhere in the code).

Therefore, the 0 int value goes to the actual check for int type, and is now handled properly.

jmcs commented 5 years ago

:+1:

hjacobs commented 5 years ago

:+1: