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

Expose advertised, not valided IPs in discovery

There are circumstances where the advertised IP is
useful information, even if that IP cannot be validated.

It is also the case that most of the time the advertised IP
is useless if not validated, so it is an optional field.
This commit is contained in:
Jarrod Johnson 2018-11-19 14:39:56 -05:00
parent 5b21a5b2c3
commit 24fd1e72e1
2 changed files with 9 additions and 1 deletions

View File

@ -44,6 +44,8 @@ columnmapping = {
'Mac': 'macs',
'Switch': 'switch',
'Port': 'port',
'Advertised IP': 'otheripaddrs',
'Other IP': 'otheripaddrs',
}
@ -208,7 +210,8 @@ def list_discovery(options, session):
columns = []
for field in options.fields.split(','):
for cdt in columnmapping:
if cdt.lower() == field.lower():
if cdt.lower().replace(
' ', '') == field.lower().replace(' ', ''):
columns.append(cdt)
else:
columns = defcolumns

View File

@ -211,6 +211,8 @@ def send_discovery_datum(info):
if infotype in servicenames:
types.append(servicenames[infotype])
yield msg.KeyValueData({'types': types})
if 'otheraddresses' in info:
yield msg.KeyValueData({'otheripaddrs': list(info['otheraddresses'])})
def _info_matches(info, criteria):
@ -637,6 +639,9 @@ def detected(info):
uuid = info.get('uuid', None)
if uuid_is_valid(uuid):
known_uuids[uuid][info['hwaddr']] = info
info['otheraddresses'] = set([])
for i4addr in info.get('attributes', {}).get('ipv4-address', []):
info['otheraddresses'].add(i4addr)
if handler and handler.https_supported and not handler.https_cert:
if handler.cert_fail_reason == 'unreachable':
log.log(