equal
deleted
inserted
replaced
15 if value : |
15 if value : |
16 yield "\t{setting:30} {value};".format(setting=setting, value=value) |
16 yield "\t{setting:30} {value};".format(setting=setting, value=value) |
17 else : |
17 else : |
18 raise ValueError("Unknown item: %r", item) |
18 raise ValueError("Unknown item: %r", item) |
19 yield "}" |
19 yield "}" |
|
20 |
|
21 def dhcp_quote (value) : |
|
22 return '"{value}"'.format(value=value) |
20 |
23 |
21 def process_host (options, host) : |
24 def process_host (options, host) : |
22 if host.owner : |
25 if host.owner : |
23 yield u"# {host.owner}".format(host=host) |
26 yield u"# {host.owner}".format(host=host) |
24 |
27 |
41 else : |
44 else : |
42 host_fmt = "{host}-{index}" |
45 host_fmt = "{host}-{index}" |
43 |
46 |
44 for index, ethernet in host.ethernet.iteritems() : |
47 for index, ethernet in host.ethernet.iteritems() : |
45 for line in build_host(host_fmt.format(host=host, index=index), |
48 for line in build_host(host_fmt.format(host=host, index=index), |
46 { 'option host-name': str(host) }, |
49 { 'option host-name': dhcp_quote(host) }, |
47 { 'hardware ethernet': ethernet }, |
50 { 'hardware ethernet': ethernet }, |
48 { 'fixed-address': host.ip }, |
51 { 'fixed-address': host.ip }, |
49 { 'next-server': next_server }, |
52 { 'next-server': next_server }, |
50 { 'filename': filename }, |
53 { 'filename': dhcp_quote(filename) }, |
51 ) : |
54 ) : |
52 yield line |
55 yield line |
53 |
56 |
54 yield "" |
57 yield "" |
55 |
58 |