ukify: fail if the config file was not read

Inspired by https://github.com/systemd/systemd/pull/28997.
Noticed by Alvin Alvarado <alvin@striczkof.io>.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-08-29 15:16:35 +03:00
parent f65aa477d9
commit 594e27b0bc
+4 -1
View File
@@ -1413,7 +1413,10 @@ def apply_config(namespace, filename=None):
# Do not make keys lowercase
cp.optionxform = lambda option: option
cp.read(filename)
# The API is not great.
read = cp.read(filename)
if not read:
raise IOError(f'Failed to read {filename}')
for section_name, section in cp.items():
idx = section_name.find(':')