From 207065aab34114d37f4d85d270629dd204c0179c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 12 Jun 2020 09:55:25 -0400 Subject: [PATCH] Fix more permission problems Some ESXi contents that need to be world readable are fixed. --- confluent_server/confluent/osimage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/osimage.py b/confluent_server/confluent/osimage.py index dbd3508d..706c781e 100644 --- a/confluent_server/confluent/osimage.py +++ b/confluent_server/confluent/osimage.py @@ -78,9 +78,13 @@ def update_boot_esxi(profiledir, profile, label): newbootcfg += 'modules= + ' --- '.join(mods) + ' --- initramfs/addons.tgz --- site.tgz\n' else: newbootcfg += cfgline + '\n' - os.makedirs('{0}/boot/efi/boot/'.format(profiledir)) - with open('{0}/boot/efi/boot/boot.cfg'.format(profiledir), 'w+') as bcfg: + os.makedirs('{0}/boot/efi/boot/'.format(profiledir), 0o755) + bcfgout = os.open('{0}/boot/efi/boot/boot.cfg'.format(profiledir), os.O_WRONLY|os.O_CREAT, 0o644) + bcfg = os.fdopen(bcfgout, 'w') + try: bcfg.write(newbootcfg) + finally: + bcfg.close() os.symlink('/var/lib/confluent/public/site/initramfs.tgz', '{0}/boot/site.tgz'.format(profiledir)) os.symlink('{0}/boot/efi/boot/boot.cfg'.format(profiledir), '{0}/boot/boot.cfg'.format(profiledir))