Ensure TTL is not 0 for zone imports

If zone imports have a ttl of 0 update
the zone ttl to the min_ttl configured for
the designate install

Change-Id: Idec854997fa9b6ad5d6af29bf6935c069dcbc40a
Closes-Bug: #1586178
This commit is contained in:
Graham Hayes 2017-05-11 12:15:23 -04:00 committed by Dai Dang Van
parent 014756c520
commit 5d9ae0ce39
1 changed files with 2 additions and 0 deletions

View File

@ -274,6 +274,8 @@ def from_dnspython_zone(dnspython_zone):
soa = dnspython_zone.get_rdataset(dnspython_zone.origin, 'SOA')
if soa is None:
raise exceptions.BadRequest('An SOA record is required')
if soa.ttl == 0:
soa.ttl = cfg.CONF['service:central'].min_ttl
email = soa[0].rname.to_text(omit_final_dot=True).decode('utf-8')
email = email.replace('.', '@', 1)
values = {