2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-03-20 02:17:52 +00:00

Populate nodename on pxe entries when possible

If a PXE is matched by UUID, populate the nodename just like the
serial number and such.
This commit is contained in:
Jarrod Johnson 2017-10-05 10:16:49 -04:00
parent 91ff08158f
commit fdc4e959f7

View File

@ -150,6 +150,7 @@ pending_nodes = {}
def enrich_pxe_info(info):
sn = None
mn = None
nodename = info.get('nodename', None)
uuid = info.get('uuid', '')
if not uuid_is_valid(uuid):
return info
@ -158,6 +159,9 @@ def enrich_pxe_info(info):
info['serialnumber'] = known_uuids[uuid][mac]['serialnumber']
if not mn and 'modelnumber' in known_uuids[uuid][mac]:
info['modelnumber'] = known_uuids[uuid][mac]['modelnumber']
if nodename is None and 'nodename' in known_uuids[uuid][mac]:
info['nodename'] = known_uuids[uuid][mac]['nodename']
def uuid_is_valid(uuid):
@ -170,10 +174,10 @@ def uuid_is_valid(uuid):
def send_discovery_datum(info):
addresses = info.get('addresses', [])
yield msg.KeyValueData({'nodename': info.get('nodename', '')})
yield msg.KeyValueData({'ipaddrs': [x[0] for x in addresses]})
if info['handler'] == pxeh:
enrich_pxe_info(info)
yield msg.KeyValueData({'nodename': info.get('nodename', '')})
yield msg.KeyValueData({'ipaddrs': [x[0] for x in addresses]})
sn = info.get('serialnumber', '')
mn = info.get('modelnumber', '')
uuid = info.get('uuid', '')