Fix Comment being None not '' and inject quotes into the TXT ChangeRecords

This commit is contained in:
Lee Webb 2018-02-13 12:00:09 +11:00 committed by rallytime
parent 5e0e2a30e2
commit e8678f633d
No known key found for this signature in database
GPG Key ID: E8F1A4B90D0DEA19

View File

@ -137,7 +137,7 @@ def _from_aws_encoding(string): # XXX TODO
def hosted_zone_present(name, Name=None, PrivateZone=False,
CallerReference=None, Comment='', VPCs=None,
CallerReference=None, Comment=None, VPCs=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure a hosted zone exists with the given attributes.
@ -642,6 +642,11 @@ def rr_present(name, HostedZoneId=None, DomainName=None, PrivateZone=False, Name
ret['result'] = False
return ret
else:
# for TXT records the entry must be encapsulated in quotes as required by the API
# this appears to be incredibly difficult with the jinja templating engine
# so inject the quotations here to make a viable ChangeBatch
if Type == 'TXT':
rr = '"%s"' % (rr)
fixed_rrs += [rr]
ResourceRecords = [{'Value': rr} for rr in sorted(fixed_rrs)]