Werk #18063: Diagnostics: Fix File size collection failing over temporary files

Component Setup
Title Diagnostics: Fix File size collection failing over temporary files
Date Jun 3, 2025
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
2.5.0b1
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.4.0p3 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

The diagnostic dump collection could fail with the following error before:

        List of all files in the site including
        their size
        ERROR - Traceback (most recent call last):
  File "/omd/sites/gui_e2e_central/lib/python3/cmk/base/diagnostics.py", line 272, in _get_filepaths
    for filepath in element.add_or_get_files(tmp_dump_folder):
  File "/omd/sites/gui_e2e_central/lib/python3/cmk/base/diagnostics.py", line 406, in add_or_get_files
    infos = self._collect_infos()
            ^^^^^^^^^^^^^^^^^^^^^
  File "/omd/sites/gui_e2e_central/lib/python3/cmk/base/diagnostics.py", line 446, in _collect_infos
    str(f.stat().st_size),
        ^^^^^^^^
  File "/omd/sites/gui_e2e_central/lib/python3.12/pathlib.py", line 840, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/omd/sites/gui_e2e_central/var/check_mk/web/cmkadmin/.session_info.mk.newodhsmg3r'

These temporary files are created by Checkmk while writing files and are now skipped by the collection.

To the list of all Werks