2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Make /networking/macs data available through nodediscover

This will help combine the data together more easily.
This commit is contained in:
Jarrod Johnson 2018-11-14 14:11:03 -05:00
parent cba514692c
commit a93a759b72

View File

@ -42,6 +42,8 @@ columnmapping = {
'Bay': 'bay',
'Mac Address': 'macs',
'Mac': 'macs',
'Switch': 'switch',
'Port': 'port',
}
@ -50,6 +52,13 @@ def print_disco(options, session, currmac, outhandler, columns):
for tmpinfo in session.read('/discovery/by-mac/{0}'.format(currmac)):
procinfo.update(tmpinfo)
if 'Switch' in columns or 'Port' in columns:
for tmpinfo in session.read(
'/networking/macs/by-mac/{0}'.format(currmac)):
if 'ports' in tmpinfo:
# The api sorts so that the most specific available value
# is last
procinfo.update(tmpinfo['ports'][-1])
record = []
for col in columns:
rawcol = columnmapping[col]