diff --git a/src/hostinfo/dhcpd.py b/src/hostinfo/dhcpd.py index 9917cfc75612eb0b51d7be98ebdf0acfed282964..cb7be61634f0e914d6162548f8b07fce9c1ffbf5 100755 --- a/src/hostinfo/dhcpd.py +++ b/src/hostinfo/dhcpd.py @@ -181,7 +181,7 @@ def generate(tree, options): served_networks = map(lambda d: util.network(get_subnet(tree, d._parent)), dhcp) result += emit_hosts(tree, options, served_networks, - pxeboot=(pxeboot != 'no')) + pxeboot=pxeboot) return str(result) def emit_interface(tree, options, interface): @@ -264,6 +264,8 @@ def emit_hosts(tree, options, networks, pxeboot=False): ethernet = ip.ethernet[0:] if not ethernet: continue + if pxeboot == 'only' and not bool(ip._pxeboot_): + continue if ethernet.lower() != ethernet: raise util.HostinfoException('%s not lower-case' % ethernet) if ip.never[0]: @@ -318,7 +320,7 @@ def emit_hosts(tree, options, networks, pxeboot=False): address=', '.join( map(str, map(util.address, ip))))) - if pxeboot: + if pxeboot != 'no': for i in ip: for p in i._pxeboot_: result += " " + p.value[0]