-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

While reviewing Rob's latest patch I found out that we didn't convert to
unicode on couple of places in the host plugin.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1b8WUACgkQHsardTLnvCWRjwCfZfOqAStP6exuq7oRlw9N4CuF
YtkAnRHwT/In85pu3E+y/w0DetsumYBF
=XUgJ
-----END PGP SIGNATURE-----
From 998b867343d1870d26a548646a6652c0c7acb838 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Wed, 16 Feb 2011 10:33:24 -0500
Subject: [PATCH] Use unicode parameters in the host plugin

---
 ipalib/plugins/host.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index bfdef57..0a97335 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -97,6 +97,10 @@ import nss.nss as nss
 import netaddr
 
 
+def _get_unicode_reverse_zone(ipaddr):
+    revzone, revname = get_reverse_zone(ipaddr)
+    return unicode(revzone), unicode(revname)
+
 def validate_host(ugettext, fqdn):
     """
     Require at least one dot in the hostname (to support localhost.localdomain)
@@ -118,7 +122,7 @@ def is_forward_record(zone, str_address):
 
 def remove_fwd_ptr(ipaddr, host, domain, recordtype):
     api.log.debug('deleting ipaddr %s' % ipaddr)
-    revzone, revname = get_reverse_zone(ipaddr)
+    revzone, revname = _get_unicode_reverse_zone(ipaddr)
     try:
         delkw = { 'ptrrecord' : "%s.%s." % (host, domain) }
         api.Command['dnsrecord_del'](revzone, revname, **delkw)
@@ -131,6 +135,7 @@ def remove_fwd_ptr(ipaddr, host, domain, recordtype):
     except errors.NotFound:
         pass
 
+
 host_output_params = (
     Flag('has_keytab',
         label=_('Keytab'),
@@ -317,7 +322,7 @@ class host_add(LDAPCreate):
                 raise errors.NotFound(reason=_('DNS zone %(zone)s not found' % dict(zone=domain)))
             if not options.get('no_reverse', False):
                 # we prefer lookup of the IP through the reverse zone
-                revzone, revname = get_reverse_zone(options['ip_address'])
+                revzone, revname = _get_unicode_reverse_zone(options['ip_address'])
                 # Verify that our reverse zone exists
                 match = False
                 for zone in result:
@@ -374,7 +379,7 @@ class host_add(LDAPCreate):
                 add_forward_record(domain, parts[0], options['ip_address'])
 
                 if not options.get('no_reverse', False):
-                    revzone, revname = get_reverse_zone(options['ip_address'])
+                    revzone, revname = _get_unicode_reverse_zone(options['ip_address'])
                     try:
                         addkw = { 'ptrrecord' : keys[-1]+'.' }
                         api.Command['dnsrecord_add'](revzone, revname, **addkw)
-- 
1.7.3.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to