From 08a5bffa90486596b8fa392d9aba470d0e14e966 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 12 Jul 2024 15:52:49 -0400 Subject: [PATCH] Write multiple grub.cfg paths Some have different requirements on how to find grub.cfg --- confluent_server/confluent/osimage.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/confluent_server/confluent/osimage.py b/confluent_server/confluent/osimage.py index e0c1a8cb..3d5f50de 100644 --- a/confluent_server/confluent/osimage.py +++ b/confluent_server/confluent/osimage.py @@ -158,7 +158,7 @@ def find_glob(loc, fileglob): for cdir, _, fs in os.walk(loc): for f in fs: if fnmatch(f, fileglob): - return os.path.join(cdir, f) + return [os.path.join(cdir, f)] return None @@ -182,9 +182,13 @@ def update_boot_linux(profiledir, profile, label): # well need to honor grubprefix path if different grubcfgpath = find_glob(profiledir + '/boot', 'grub.cfg') if not grubcfgpath: - grubcfgpath = profiledir + '/boot/efi/boot/grub.cfg' - with open(grubcfgpath, 'w') as grubout: - grubout.write(grubcfg) + grubcfgpath = [ + profiledir + '/boot/efi/boot/grub.cfg' + profiledir + '/boot/boot/grub.cfg' + ] + for grubcfgpth in grubcfgpath: + with open(grubcfgpth, 'w') as grubout: + grubout.write(grubcfg) ipxeargs = kernelargs for initramfs in initrds: ipxeargs += " initrd=" + initramfs