Werk #17390: Fix update of graph collections with combined graphs

Component Metrics system
Title Fix update of graph collections with combined graphs
Date Oct 25, 2024
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
2.3.0p20 Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

Updating a site from 2.2 to 2.3 might have failed if there were graph collections with combined graphs. The error message read:

 23/29 Update pagetypes...
 + "Update pagetypes" failed
Traceback (most recent call last):
  File "/omd/sites/stable/lib/python3/cmk/update_config/main.py", line 269, in update_config
    action(logger, update_state.setdefault(action.name))
  File "/omd/sites/stable/lib/python3/cmk/update_config/plugins/actions/pagetypes.py", line 55, in __call__
    raw_page_dicts = updater(raw_page_dicts)
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/stable/lib/python3/cmk/update_config/cee/plugins/actions/pagetypes.py", line 51, in __call__
    element["parameters"] = self._parse_graph_specification(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/stable/lib/python3/cmk/update_config/cee/plugins/actions/pagetypes.py", line 75, in _parse_graph_specification
    return _parse_legacy_graph_identifier(raw_spec)  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/stable/lib/python3/cmk/update_config/cee/plugins/actions/pagetypes.py", line 101, in _parse_legacy_graph_identifier
    return parse_raw_graph_specification({"graph_type": identifier[0]} | dict(graph_spec))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/stable/lib/python3/cmk/gui/graphing/_graph_specification.py", line 223, in parse_raw_graph_specification
    ].model_validate(raw)
      ^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/stable/lib/python3.12/site-packages/pydantic/main.py", line 503, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for CombinedGraphSpecification
context.host
  Input should be a valid dictionary [type=dict_type, input_value='my-host', input_type=str]
    For further information visit https://errors.pydantic.dev/2.5/v/dict_type

To the list of all Werks