diff --git a/glances/stats_client_snmp.py b/glances/stats_client_snmp.py index cc660a44..8edc5c41 100644 --- a/glances/stats_client_snmp.py +++ b/glances/stats_client_snmp.py @@ -74,18 +74,11 @@ class GlancesStatsClientSNMP(GlancesStats): def get_system_name(self, oid_system_name): """Get the short os name from the OS name OID string.""" - short_system_name = None - - if oid_system_name == '': - return short_system_name - - # Find the short name in the oid_to_short_os_name dict - for r, v in oid_to_short_system_name.items(): - if re.search(r, oid_system_name): - short_system_name = v - break - - return short_system_name + return ( + next((v for r, v in oid_to_short_system_name.items() if re.search(r, oid_system_name)), None) + if oid_system_name + else None + ) def update(self): """Update the stats using SNMP."""