Skip to content

Commit 5c79e63

Browse files
committed
Ensure consistent hostname setting
During the initial node discovery, we retrieve the hostname for a device and use that. However, on initializing the SSH for the first time, we also reinit the hostname, and sometimes from a different command than whats present in the initial node discovery phase. The hostname needs to be whatever is advertised in LLDP because that is how we find peers of an interface and is essential for many tasks that we do. This diff in hostname computed during node discovery from the one in polling can cause us to recreate incorrect hostnames. This patch ensures that we only ever use the hostname computed during ssh setup after node discovery. Signed-off-by: Dinesh Dutt <[email protected]>
1 parent e41f902 commit 5c79e63

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

suzieq/poller/worker/nodes/node.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,11 @@ async def _parse_device_type_hostname(self, output, _) -> None:
409409
f'Detected {devtype} for {self.address}:{self.port},'
410410
f' {hostname}')
411411
self._set_devtype(devtype, version_str)
412-
self._set_hostname(hostname)
412+
# We don't set the hostname here because the real hostname
413+
# is retrieved via a different command on some platforms
414+
# and can contain the FQDN. The hostname stored with a
415+
# record needs to be one that is also used in LLDP so that we
416+
# can find interface peers
413417
self.current_exception = None
414418

415419
async def _detect_node_type(self):

0 commit comments

Comments
 (0)