From de2a18bdb8a06476b5fc2b73416d02df42f876d6 Mon Sep 17 00:00:00 2001 From: Adam Glasgall Date: Sun, 28 Apr 2013 14:25:36 -0400 Subject: [PATCH 1/1] pydhcpserver expects ip strings as strs, and sqlalchemy returns unistrings --- debian/changelog | 7 +++++++ invirt-dhcpserver | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 35ac10e..3cb13d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sun, 28 Apr 2013 14:14:17 -0400 + invirt-dhcp (0.0.6~glasgall1) precise; urgency=low * Port to Precise, with sqlalchemy api changes diff --git a/invirt-dhcpserver b/invirt-dhcpserver index 9f6fb68..c017447 100755 --- a/invirt-dhcpserver +++ b/invirt-dhcpserver @@ -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) -- 1.7.9.5