Stages/tuned: skip non-existing profile directories

Previously, the stage would try to call `os.scandir()` on non-existing
profile directories, which results in an exception. While the
directories that it scans are currently created by the TuneD RPM package
when installed, it it much nicer to gracefully handle their potential
non-existence, than to fail with an exception.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-12-20 12:49:42 +01:00 committed by Brian C. Lane
parent 350ae9ed40
commit 67d9663c83

View file

@ -34,6 +34,9 @@ class TunedProfilesDB:
for path in profile_directories:
profiles_dir = f"{tree}{path}"
if not os.path.isdir(profiles_dir):
continue
# Since version 2.23.0, TuneD by default uses `profiles/` subdirectory.
# If the subdirectory exists, we look for profiles there.
if os.path.isdir(f"{profiles_dir}/profiles"):