mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
add host key as alias for sysname neighbors facts (#49827)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
2adb9f32ae
commit
e944dba166
1 changed files with 5 additions and 3 deletions
|
@ -495,7 +495,7 @@ class Interfaces(FactsBase):
|
|||
objects[local_intf] = list()
|
||||
nbor = dict()
|
||||
nbor['port'] = item['port_id']
|
||||
nbor['sysname'] = item['chassis_id']
|
||||
nbor['host'] = nbor['sysname'] = item['chassis_id']
|
||||
objects[local_intf].append(nbor)
|
||||
|
||||
return objects
|
||||
|
@ -512,7 +512,7 @@ class Interfaces(FactsBase):
|
|||
objects[local_intf] = list()
|
||||
nbor = dict()
|
||||
nbor['port'] = item['port_id']
|
||||
nbor['sysname'] = item['device_id']
|
||||
nbor['host'] = nbor['sysname'] = item['device_id']
|
||||
objects[local_intf].append(nbor)
|
||||
|
||||
return objects
|
||||
|
@ -645,7 +645,9 @@ class Interfaces(FactsBase):
|
|||
for item in data.split('\n')[4:-1]:
|
||||
match = regex.match(item)
|
||||
if match:
|
||||
nbor = {'host': match.group(1), 'port': match.group(3)}
|
||||
nbor = dict()
|
||||
nbor['host'] = nbor['sysname'] = match.group(1)
|
||||
nbor['port'] = match.group(3)
|
||||
local_intf = normalize_interface(match.group(2))
|
||||
if local_intf not in objects:
|
||||
objects[local_intf] = []
|
||||
|
|
Loading…
Reference in a new issue