diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-08-28 17:44:42 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-08-29 14:16:35 +0200 |
commit | 594e27b0bc896a84017db02227e45e172186d1a5 (patch) | |
tree | 15c882a3cbcf77ae6d072a90a0d06345b9baf6b9 /src/ukify/ukify.py | |
parent | ukify: move to /usr/bin and mark as non non-experimental (diff) | |
download | systemd-594e27b0bc896a84017db02227e45e172186d1a5.tar.xz systemd-594e27b0bc896a84017db02227e45e172186d1a5.zip |
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>.
Diffstat (limited to 'src/ukify/ukify.py')
-rwxr-xr-x | src/ukify/ukify.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 10a464bb1a..b7e21dafed 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -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(':') |