pydhcpserver expects ip strings as strs, and sqlalchemy returns unistrings
authorAdam Glasgall <glasgall@mit.edu>
Sun, 28 Apr 2013 18:25:36 +0000 (14:25 -0400)
committerAdam Glasgall <glasgall@mit.edu>
Sun, 28 Apr 2013 18:25:36 +0000 (14:25 -0400)
debian/changelog
invirt-dhcpserver

index 35ac10e..3cb13d2 100644 (file)
@@ -1,3 +1,10 @@
+invirt-dhcp (0.0.6~glasgall2) precise; urgency=low
+
+  * pydhcpserver expects IP address strings to be strs. encode the
+    unistrings sqlalchemy gives us accordingly.
+
+ -- Adam Glasgall <glasgall@mit.edu>  Sun, 28 Apr 2013 14:14:17 -0400
+
 invirt-dhcp (0.0.6~glasgall1) precise; urgency=low
 
   * Port to Precise, with sqlalchemy api changes
index 9f6fb68..c017447 100755 (executable)
@@ -31,7 +31,7 @@ class DhcpBackend:
         nic = self.findNIC(str(chaddr))
         if nic is None or nic.ip is None:
             return None
-        ipstr = ''.join(reversed(['%02X' % i for i in ipv4(nic.ip).list()]))
+        ipstr = ''.join(reversed(['%02X' % i for i in ipv4(nic.ip.encode("utf-8")).list()]))
         for line in open('/proc/net/route'):
             parts = line.split()
             if parts[1] == ipstr:
@@ -114,7 +114,7 @@ class DhcpBackend:
             del options['domain_name']
             options['domain_search'] = [config.dhcp.search_domain]
         if ip is not None:
-            ip = ipv4(ip)
+            ip = ipv4(ip.encode("utf-8"))
             s.syslog(s.LOG_DEBUG,"dhcp_backend : Discover result = "+str(ip))
             packet_parameters = self.getParameters(**options)