Add forgotten trailing dots in DNS records

583023
This commit is contained in:
Martin Nagy 2010-04-19 03:39:52 +02:00 committed by Rob Crittenden
parent 6e9cc2640b
commit 04182bf68f
2 changed files with 11 additions and 4 deletions

View File

@ -95,6 +95,13 @@ _zone_default_attributes = [
]
# normalizer for admin email
def _rname_normalizer(value):
value = value.replace('@', '.')
if not value.endswith('.'):
value += '.'
return value
# build zone dn
def _get_zone_dn(ldap, idnsname):
rdn = ldap.make_rdn_from_attr('idnsname', idnsname)
@ -129,7 +136,7 @@ class dns(Object):
cli_name='admin_email',
label=_('administrator e-mail address'),
default_from=lambda idnsname: 'root.%s' % idnsname,
normalizer=lambda value: value.replace('@', '.'),
normalizer=_rname_normalizer,
),
Int('idnssoaserial?',
cli_name='serial',

View File

@ -93,7 +93,7 @@ def add_zone(name, update_policy=None, dns_backup=None):
try:
api.Command.dns_add(unicode(name),
idnssoamname=unicode(api.env.host),
idnssoamname=unicode(api.env.host+"."),
idnsallowdynupdate=True,
idnsupdatepolicy=unicode(update_policy))
except (errors.DuplicateEntry, errors.EmptyModlist):
@ -109,13 +109,13 @@ def add_reverze_zone(ip_address, update_policy=None, dns_backup=None):
update_policy = "grant %s krb5-subdomain %s. PTR;" % (api.env.realm, zone)
try:
api.Command.dns_add(unicode(zone),
idnssoamname=unicode(api.env.host),
idnssoamname=unicode(api.env.host+"."),
idnsallowdynupdate=True,
idnsupdatepolicy=unicode(update_policy))
except (errors.DuplicateEntry, errors.EmptyModlist):
pass
add_rr(zone, "@", "NS", api.env.host, dns_backup)
add_rr(zone, "@", "NS", api.env.host+".", dns_backup)
return zone