Skip to content

Commit

Permalink
dmidecode (inv plugin): Move counter increments
Browse files Browse the repository at this point in the history
Change-Id: I43661f7c693c917e01969723b98c7a8ce5b7c220
  • Loading branch information
si-23 committed Feb 11, 2025
1 parent 944ff1c commit 1da49e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmk/plugins/collection/agent_based/inventory_dmidecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ def inventory_dmidecode(section: Section) -> InventoryResult:
case "Processor Information":
yield from _make_inventory_processor(lines)
case "Physical Memory Array":
counter.update({"physical_memory_array": 1})
yield _make_inventory_physical_mem_array(lines, counter)
case "Memory Device":
counter.update({"memory_device": 1})
yield from _make_inventory_mem_device(lines, counter)


Expand Down Expand Up @@ -211,6 +209,7 @@ def _make_inventory_physical_mem_array(
lines: list[list[str]],
counter: Counter[Literal["physical_memory_array", "memory_device"]],
) -> Attributes:
counter.update({"physical_memory_array": 1})
# We expect several possible arrays
return Attributes(
path=["hardware", "memory", "arrays", str(counter["physical_memory_array"])],
Expand Down Expand Up @@ -255,6 +254,7 @@ def _make_inventory_mem_device(
device["speed"] = _parse_speed(device.get("speed", "Unknown")) # type: ignore[arg-type]
device["size"] = _parse_size(device.get("size", "Unknown")) # type: ignore[arg-type]

counter.update({"memory_device": 1})
key_columns = {k: device.pop(k) for k in ("set",)}
key_columns.update({"index": counter["memory_device"]})
yield TableRow(
Expand Down

0 comments on commit 1da49e1

Please sign in to comment.