Werk #16435: agent_netapp_ontap: Fix TypeError for SnapVault

Component Checks & agents
Title agent_netapp_ontap: Fix TypeError for SnapVault
Date Jun 26, 2024
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
2.4.0b1
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.3.0p8 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

Previously, agent_netapp_ontap would crash if the API returned any SnapMirror objects:

  File "/omd/sites/mysite/local/lib/python3/cmk/special_agents/agent_netapp_ontap.py", line 827, in write_sections
    write_section("snapvault", fetch_snapmirror(connection), logger)
  File "/omd/sites/mysite/local/lib/python3/cmk/special_agents/agent_netapp_ontap.py", line 32, in write_section
    writer.append_json(element.model_dump(exclude_unset=True, exclude_none=False))
  File "/omd/sites/mysite/lib/python3/cmk/special_agents/v0_unstable/agent_common.py", line 62, in append_json
    self.writeline(json.dumps(data, sort_keys=True))
  File "/omd/sites/mysite/lib/python3.12/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/omd/sites/mysite/lib/python3.12/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/omd/sites/mysite/lib/python3.12/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
  File "/omd/sites/mysite/lib/python3.12/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '

To the list of all Werks