tools/image-info: dont fail if /boot/grub2/grubenv is missing

The file is missing on non-bootable images and we skip missing files in
all other cases. Do it in this one as well.
This commit is contained in:
Martin Sehnoutka 2020-04-09 11:01:15 +02:00 committed by Tom Gundersen
parent 4f502a286c
commit bceb51b330

View file

@ -228,8 +228,11 @@ def append_filesystem(report, tree):
if os.path.exists(f"{tree}/boot") and len(os.listdir(f"{tree}/boot")) > 0:
assert "bootmenu" not in report
with open(f"{tree}/boot/grub2/grubenv") as f:
report["boot-environment"] = parse_environment_vars(f.read())
try:
with open(f"{tree}/boot/grub2/grubenv") as f:
report["boot-environment"] = parse_environment_vars(f.read())
except FileNotFoundError:
pass
report["bootmenu"] = read_boot_entries(f"{tree}/boot")
elif len(glob.glob(f"{tree}/vmlinuz-*")) > 0: