Fix crash in DNS installer.

Fix #927
This commit is contained in:
Pavel Zuna 2011-02-07 12:52:07 -05:00 committed by Rob Crittenden
parent acc437c5fe
commit 46dbf0ae55

View File

@ -156,7 +156,7 @@ def add_reverse_zone(ip_address, update_policy=None, dns_backup=None):
return zone return zone
def add_rr(zone, name, type, rdata, dns_backup=None, **kwargs): def add_rr(zone, name, type, rdata, dns_backup=None, **kwargs):
addkw = { '%srecord' % unicode(type.lower()) : unicode(rdata) } addkw = { '%srecord' % str(type.lower()) : unicode(rdata) }
addkw.update(kwargs) addkw.update(kwargs)
try: try:
api.Command.dnsrecord_add(unicode(zone), unicode(name), **addkw) api.Command.dnsrecord_add(unicode(zone), unicode(name), **addkw)
@ -177,7 +177,7 @@ def add_ptr_rr(ip_address, fqdn, dns_backup=None):
add_rr(zone, name, "PTR", fqdn+".", dns_backup) add_rr(zone, name, "PTR", fqdn+".", dns_backup)
def del_rr(zone, name, type, rdata): def del_rr(zone, name, type, rdata):
delkw = { '%srecord' % unicode(type.lower()) : unicode(rdata) } delkw = { '%srecord' % str(type.lower()) : unicode(rdata) }
try: try:
api.Command.dnsrecord_del(unicode(zone), unicode(name), **delkw) api.Command.dnsrecord_del(unicode(zone), unicode(name), **delkw)
except (errors.NotFound, errors.EmptyModlist): except (errors.NotFound, errors.EmptyModlist):
@ -232,7 +232,7 @@ class DnsBackup(object):
if have_ldap: if have_ldap:
type, host, rdata = dns_record.split(" ", 2) type, host, rdata = dns_record.split(" ", 2)
try: try:
delkw = { '%srecord' % unicode(type.lower()) : unicode(rdata) } delkw = { '%srecord' % str(type.lower()) : unicode(rdata) }
api.Command.dnsrecord_del(unicode(zone), unicode(host), **delkw) api.Command.dnsrecord_del(unicode(zone), unicode(host), **delkw)
except: except:
pass pass