From a92d5b3bb711550b355a72a8da93c89bf9fe9e9f Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Fri, 29 Sep 2023 15:46:19 -0400 Subject: [PATCH] Nagstamon.Helpers.get_distro: ignore lines missing an equal sign --- Nagstamon/Helpers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Nagstamon/Helpers.py b/Nagstamon/Helpers.py index 408ce4a9b..7b0de31d0 100644 --- a/Nagstamon/Helpers.py +++ b/Nagstamon/Helpers.py @@ -453,8 +453,9 @@ def get_distro(): os_release_dict = {} for line in os_release_file.read_text().splitlines(): if not line.startswith('#'): - key, value = line.split('=', 1) - os_release_dict[key] = value.strip('"').strip("'") + try: key, value = line.split('=', 1) + except ValueError: continue + else: os_release_dict[key] = value.strip('"').strip("'") # Since CentOS Linux got retired by Red Hat, there are various RHEL derivatives/clones; flow is: # CentOS Stream -> Red Hat Enterprise Linux -> (AlmaLinux, EuroLinux, Oracle Linux, Rocky Linux) # Goal of this hack is to rule them all as Red Hat Enterprise Linux, the baseline distribution.