From 0badb83836184e9883bd25a62c8f918cdf936544 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 18 Jan 2011 14:07:02 +0100 Subject: [PATCH] always pass log to sysexec for consistency between bm.log and tty output --- source/steps/ChainBootNode.py | 5 ++--- source/steps/InstallBootstrapFS.py | 4 ++-- source/steps/InstallInit.py | 8 ++++---- source/steps/MakeInitrd.py | 12 ++++++------ source/steps/UpdateNodeConfiguration.py | 4 ++-- source/steps/ValidateNodeInstall.py | 4 ++-- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/source/steps/ChainBootNode.py b/source/steps/ChainBootNode.py index 43f4688..3b9df6d 100644 --- a/source/steps/ChainBootNode.py +++ b/source/steps/ChainBootNode.py @@ -262,11 +262,10 @@ def Run( vars, log ): # kargs, which is ramdisk_size=8192 pass - utils.sysexec_noerr( 'hwclock --systohc --utc ' ) + utils.sysexec_noerr( 'hwclock --systohc --utc ', log ) utils.breakpoint ("Before kexec"); try: - utils.sysexec( 'kexec --force --initrd=/tmp/initrd ' \ - '--append="%s" /tmp/kernel' % kargs) + utils.sysexec( 'kexec --force --initrd=/tmp/initrd --append="%s" /tmp/kernel' % kargs, log) except BootManagerException, e: # if kexec fails, we've shut the machine down to a point where nothing # can run usefully anymore (network down, all modules unloaded, file diff --git a/source/steps/InstallBootstrapFS.py b/source/steps/InstallBootstrapFS.py index 67930e3..a40e2e3 100644 --- a/source/steps/InstallBootstrapFS.py +++ b/source/steps/InstallBootstrapFS.py @@ -179,7 +179,7 @@ def Run( vars, log ): utils.makedirs(SYSIMG_PATH + "/etc/pki/rpm-gpg") utils.sysexec("gpg --homedir=/root --export --armor" \ " --no-default-keyring --keyring %s/usr/boot/pubring.gpg" \ - " >%s/etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab" % (SYSIMG_PATH, SYSIMG_PATH)) - utils.sysexec_chroot(SYSIMG_PATH, "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab") + " >%s/etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab" % (SYSIMG_PATH, SYSIMG_PATH), log) + utils.sysexec_chroot(SYSIMG_PATH, "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab", log) return 1 diff --git a/source/steps/InstallInit.py b/source/steps/InstallInit.py index 2cf247a..32fbafe 100644 --- a/source/steps/InstallInit.py +++ b/source/steps/InstallInit.py @@ -64,10 +64,10 @@ def Run( vars, log ): except OSError, e: pass - utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH ) - utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH ) - utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH ) - utils.sysexec_noerr( "umount %s" % SYSIMG_PATH ) + utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH , log ) + utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH , log ) + utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH , log ) + utils.sysexec_noerr( "umount %s" % SYSIMG_PATH , log ) vars['ROOT_MOUNTED']= 0 # log.write( "Removing any old files, directories\n" ) diff --git a/source/steps/MakeInitrd.py b/source/steps/MakeInitrd.py index 878f28b..a98c8f0 100644 --- a/source/steps/MakeInitrd.py +++ b/source/steps/MakeInitrd.py @@ -15,14 +15,14 @@ import systeminfo # for centos5.3 # 14:42:27(UTC) No module dm-mem-cache found for kernel 2.6.22.19-vs2.3.0.34.33.onelab, aborting. # http://kbase.redhat.com/faq/docs/DOC-16528;jsessionid=7E984A99DE8DB094D9FB08181C71717C.ab46478d -def bypassRaidIfNeeded(sysimg_path): +def bypassRaidIfNeeded(sysimg_path, log): try: [ a,b,c,d]=file('%s/etc/redhat-release'%sysimg_path).readlines()[0].strip().split() if a !='CentOS': return [major,minor]=[int(x) for x in c.split('.')] if minor >= 3: - utils.sysexec_noerr('echo "DMRAID=no" >> %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path) - utils.sysexec_noerr('chmod 755 %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path) + utils.sysexec_noerr('echo "DMRAID=no" >> %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path , log ) + utils.sysexec_noerr('chmod 755 %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path, log ) except: pass @@ -67,10 +67,10 @@ def Run( vars, log ): print "%s/boot/%s is already removed" % (SYSIMG_PATH, initrd) # hack for CentOS 5.3 - bypassRaidIfNeeded(SYSIMG_PATH) + bypassRaidIfNeeded(SYSIMG_PATH , log ) utils.sysexec_chroot( SYSIMG_PATH, "mkinitrd -v --allow-missing /boot/initrd-%s.img %s" % \ (kernel_version, kernel_version), log ) - utils.sysexec_noerr("umount %s/sys" % SYSIMG_PATH) - utils.sysexec_noerr("umount %s/dev" % SYSIMG_PATH) + utils.sysexec_noerr("umount %s/sys" % SYSIMG_PATH , log ) + utils.sysexec_noerr("umount %s/dev" % SYSIMG_PATH , log) diff --git a/source/steps/UpdateNodeConfiguration.py b/source/steps/UpdateNodeConfiguration.py index cbb0033..683bd94 100644 --- a/source/steps/UpdateNodeConfiguration.py +++ b/source/steps/UpdateNodeConfiguration.py @@ -185,8 +185,8 @@ def update_vserver_network_files( vserver_dir, vars, log ): # 2.6.22/f8 root environment. files randomly show up with the # immutible attribute set. this clears it before trying to write # the files below. - utils.sysexec( "chattr -i %s/etc/hosts" % vserver_dir ) - utils.sysexec( "chattr -i %s/etc/resolv.conf" % vserver_dir ) + utils.sysexec( "chattr -i %s/etc/hosts" % vserver_dir , log ) + utils.sysexec( "chattr -i %s/etc/resolv.conf" % vserver_dir , log ) except: pass diff --git a/source/steps/ValidateNodeInstall.py b/source/steps/ValidateNodeInstall.py index 771813c..c987170 100644 --- a/source/steps/ValidateNodeInstall.py +++ b/source/steps/ValidateNodeInstall.py @@ -87,13 +87,13 @@ def Run( vars, log ): try: # first run fsck to prevent fs corruption from hanging mount... log.write( "fsck %s file system\n" % filesystem ) - utils.sysexec("e2fsck -v -p %s" % (PARTITIONS[filesystem]),log, True) + utils.sysexec("e2fsck -v -p %s" % (PARTITIONS[filesystem]), log, fsck=True) except BootManagerException, e: log.write( "BootManagerException during fsck of %s (%s) filesystem : %s\n" % (filesystem, PARTITIONS[filesystem], str(e)) ) try: log.write( "Trying to recover filesystem errors on %s\n" % filesystem ) - utils.sysexec("e2fsck -v -y %s" % (PARTITIONS[filesystem]),log, True) + utils.sysexec("e2fsck -v -y %s" % (PARTITIONS[filesystem]),log, fsck=True) except BootManagerException, e: log.write( "BootManagerException during trying to recover filesystem errors on %s (%s) filesystem : %s\n" % (filesystem, PARTITIONS[filesystem], str(e)) ) -- 2.43.0