Skip to content

Commit

Permalink
Fixes: is not a valid PhysicalClasses
Browse files Browse the repository at this point in the history
In PhysicalClasses are only the values from 1 to 12 defined (this acording to the MIB description). 
For all other values is an explicit errorhandling implemented (currently only for "0","" and "14").
This fix will change this, so that for every value other than 1-12 the physical classe "unknown" is returned.

Werk 15633 was only fixing ths error for the value 14.

One Example from a Cisco Stack:

        ['1001', '13', 'StackPort1'],
        ['1002', '14', 'StackAdapter1'],
        
Here the value 13 results in a crash of the inventory plugins.
  • Loading branch information
thl-cmk committed Jun 29, 2023
1 parent 7cba3f4 commit 64b2724
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cmk/base/plugins/agent_based/utils/entity_mib.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class PhysicalClasses(Enum):
# SUP-10602: Cisco decided to not stick to the official MiB ...
@classmethod
def parse_cisco(cls, raw_phys_class: str) -> "PhysicalClasses":
match raw_phys_class:
case "0" | "" | "14":
return cls.unknown
case _:
return cls(raw_phys_class)
try:
return cls(raw_phys_class)
except ValueError:
return cls.unknown

0 comments on commit 64b2724

Please sign in to comment.