From 6282077fe0edb3c06247cdcfb3ec7605c78e56c7 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Mon, 8 Jun 2026 13:07:54 -0400 Subject: [PATCH] fix: correct zero-safe pathconf checks and connectivity prefix match - Use `is not None` for pathconf values so 0 is not silently dropped - Broaden connectivity prefix check to catch bare "connectivity" key Co-Authored-By: Claude Sonnet 4.6 --- hbd/client/plugins/filesystem_info.py | 6 +++--- hbd/server/threshold.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hbd/client/plugins/filesystem_info.py b/hbd/client/plugins/filesystem_info.py index 4cdd7ef..e75463a 100644 --- a/hbd/client/plugins/filesystem_info.py +++ b/hbd/client/plugins/filesystem_info.py @@ -127,15 +127,15 @@ class FilesystemInfoPlugin(InfoPlugin): try: # Maximum filename length max_name = os.pathconf(partition.mountpoint, 'PC_NAME_MAX') - if max_name: + if max_name is not None: fs_info['maxfile'] = max_name except (OSError, ValueError): pass - + try: # Maximum path length max_path = os.pathconf(partition.mountpoint, 'PC_PATH_MAX') - if max_path: + if max_path is not None: fs_info['maxpath'] = max_path except (OSError, ValueError): pass diff --git a/hbd/server/threshold.py b/hbd/server/threshold.py index 9d88d83..07813d7 100644 --- a/hbd/server/threshold.py +++ b/hbd/server/threshold.py @@ -1556,7 +1556,7 @@ class ThresholdChecker: for mp in host.alert_states: # connectivity.* and rtt are managed by the connection state # machine, not by threshold config — never purge them. - if mp == "rtt" or mp.startswith("connectivity."): + if mp == "rtt" or mp.startswith("connectivity"): continue if self._find_threshold(configured, mp)[0] is not None: continue