diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-12-26 15:02:42 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-12-26 15:02:42 +0200 |
commit | c89bca220360f833183c1d7290ee9f4f444ca490 (patch) | |
tree | 9a7a2d2e98cd8b6b0e3701eb67a8b62a565a610e | |
parent | 65adab0fdd4913cdb391def13f155c8a416f9660 (diff) | |
download | vmdb2-c89bca220360f833183c1d7290ee9f4f444ca490.tar.gz |
Fix: run 'apt-get update' before installing grub
We may have unpacked the rootfs tarball, and the Packages files may be
out of date. The 'apt-get update' fixes this, and is not too slow.
This is a crummy fix. Better would be for the debootstrap step to
always run the update, but the way steps are skipped doesn't allow
that at the moment.
-rw-r--r-- | vmdb/plugins/grub_plugin.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py index 64522ec..4c06d40 100644 --- a/vmdb/plugins/grub_plugin.py +++ b/vmdb/plugins/grub_plugin.py @@ -139,6 +139,7 @@ class GrubStepRunner(vmdb.StepRunnerInterface): self.bind_mount_many(chroot, ['/dev', '/proc', '/sys'], state) if efi_dev: self.mount(chroot, efi_dev, '/boot/efi', state) + self.apt_update(chroot) self.install_package(chroot, grub_package) kernel_params = [ @@ -225,6 +226,11 @@ class GrubStepRunner(vmdb.StepRunnerInterface): def chroot_path(self, chroot, path): return os.path.normpath(os.path.join(chroot, '.' + path)) + def apt_update(self, chroot): + env = os.environ.copy() + env['DEBIAN_FRONTEND'] = 'noninteractive' + vmdb.runcmd_chroot(chroot, ['apt-get', 'update'], env=env) + def install_package(self, chroot, package): env = os.environ.copy() env['DEBIAN_FRONTEND'] = 'noninteractive' |