From 297e82694f77e705c70025c2160f8b9fc2bc9db2 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Fri, 23 Mar 2018 12:17:02 +0100 Subject: [PATCH] Only emit hosts with pxeboot values for pxeboot dhcp --- src/hostinfo/dhcpd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hostinfo/dhcpd.py b/src/hostinfo/dhcpd.py index 9917cfc..cb7be61 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] -- GitLab