Skip to content

Commit

Permalink
Allows MultiAZ=false with AvailabilityZone in rds (#524)
Browse files Browse the repository at this point in the history
* Allows MultiAZ=false with AvailabilityZone in rds Fixes #523
* Add a few more tests
  • Loading branch information
phobologic authored and markpeek committed Jul 6, 2016
1 parent 4c73735 commit 5bb92cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 10 additions & 1 deletion tests/test_rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import troposphere.rds as rds
from troposphere import If, Parameter, Ref

AWS_NO_VALUE = "AWS::NoValue"


class TestRDS(unittest.TestCase):

Expand Down Expand Up @@ -150,9 +152,16 @@ def test_fail_az_and_multiaz(self):
MultiAZ=True)
with self.assertRaisesRegexp(ValueError, "if MultiAZ is set to "):
i.JSONrepr()
i.MultiAZ = "false"
i.JSONrepr()
i.MultiAZ = "true"
with self.assertRaisesRegexp(ValueError, "if MultiAZ is set to "):
i.JSONrepr()

i.MultiAZ = Ref(AWS_NO_VALUE)
i.JSONrepr()

def test_az_and_multiaz_funcs(self):
AWS_NO_VALUE = "AWS::NoValue"
db_az = "us-east-1"
db_multi_az = Parameter("dbmultiaz", Type="String")
i = rds.DBInstance(
Expand Down
3 changes: 1 addition & 2 deletions troposphere/rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ def validate(self):
multi_az = self.properties.get('MultiAZ', None)
if not (isinstance(avail_zone, (AWSHelperFn, nonetype)) and
isinstance(multi_az, (AWSHelperFn, nonetype))):
if 'AvailabilityZone' in self.properties and \
self.properties.get('MultiAZ', None):
if avail_zone and multi_az in [True, 1, '1', 'true', 'True']:
raise ValueError("AvailabiltyZone cannot be set on "
"DBInstance if MultiAZ is set to true.")

Expand Down

0 comments on commit 5bb92cc

Please sign in to comment.