From f0bda4a15ab2a812734e28e5f3b9a9306adc9068 Mon Sep 17 00:00:00 2001 From: Travis Cotton Date: Wed, 9 Oct 2024 09:38:07 -0600 Subject: [PATCH] a not so great fix for preventing any non NMN type of network interface from getting added to the optsfile and tagged with the nidname --- dnsmasq_updater.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dnsmasq_updater.py b/dnsmasq_updater.py index 021595b..999c8ef 100644 --- a/dnsmasq_updater.py +++ b/dnsmasq_updater.py @@ -51,7 +51,8 @@ def template_file(base_url, bootscript_base_url, access_token, hostsfilename, op with hostsfilepath.open("w") as hostsfile: #this for loop writes host entries for i in ei_data: - if i['Type'] != 'NodeBMC': + itype = i['IPAddresses'][0]['Network'] + if i['Type'] != 'NodeBMC' and itype == 'NMN': nidname=getNID(component_data, i['ComponentID']) if nidname: print(f"{i['MACAddress']},set:{nidname},{i['IPAddresses'][0]['IPAddress']},{nidname}", file=hostsfile) @@ -71,7 +72,8 @@ def template_file(base_url, bootscript_base_url, access_token, hostsfilename, op with optsfilepath.open("w") as optsfile: #this for loop writes option entries, we wouldn't need it if the BSS wasn't MAC specific for i in ei_data: - if 'bmc' not in i['Description']: + itype = i['IPAddresses'][0]['Network'] + if 'bmc' not in i['Description'] and itype == 'NMN': nidname=getNID(component_data, i['ComponentID']) if nidname: print(f"tag:{nidname},tag:IPXEBOOT,option:bootfile-name,\"{bootscript_base_url}/boot/v1/bootscript?mac={i['MACAddress']}\"", file=optsfile)