--- a/bin/pvl.hosts-dhcp Thu Dec 19 02:50:59 2013 +0200
+++ b/bin/pvl.hosts-dhcp Thu Dec 19 03:06:51 2013 +0200
@@ -18,6 +18,9 @@
raise ValueError("Unknown item: %r", item)
yield "}"
+def dhcp_quote (value) :
+ return '"{value}"'.format(value=value)
+
def process_host (options, host) :
if host.owner :
yield u"# {host.owner}".format(host=host)
@@ -43,11 +46,11 @@
for index, ethernet in host.ethernet.iteritems() :
for line in build_host(host_fmt.format(host=host, index=index),
- { 'option host-name': str(host) },
+ { 'option host-name': dhcp_quote(host) },
{ 'hardware ethernet': ethernet },
{ 'fixed-address': host.ip },
{ 'next-server': next_server },
- { 'filename': filename },
+ { 'filename': dhcp_quote(filename) },
) :
yield line