summaryrefslogtreecommitdiffstats
path: root/perl/lib/Sys/Guestfs
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2010-05-07 14:58:32 +0100
committerRichard Jones <rjones@redhat.com>2010-05-07 15:23:37 +0100
commit4839d5142ca50818965866287932f9ded14729e6 (patch)
treec3f9fb2d7135ada5779f515a524fd452240cfe3b /perl/lib/Sys/Guestfs
parent01c1d82823be7008d7930e7876c31939227a4f41 (diff)
downloadlibguestfs-4839d5142ca50818965866287932f9ded14729e6.tar.gz
libguestfs-4839d5142ca50818965866287932f9ded14729e6.tar.xz
libguestfs-4839d5142ca50818965866287932f9ded14729e6.zip
Warn instead of dying if grub refers to non-existent kernel
Diffstat (limited to 'perl/lib/Sys/Guestfs')
-rw-r--r--perl/lib/Sys/Guestfs/Lib.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index b6c4a31f..8ec487dc 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -1643,8 +1643,14 @@ sub _check_for_kernels
}
$config{cmdline} = join(' ', @args) if(scalar(@args) > 0);
- my $kernel =
- inspect_linux_kernel($g, $path, $os->{package_format});
+ my $kernel;
+ if ($g->exists($path)) {
+ $kernel =
+ inspect_linux_kernel($g, $path, $os->{package_format});
+ } else {
+ warn __x("grub refers to {path}, which doesn't exist\n",
+ path => $path);
+ }
# Check the kernel was recognised
if(defined($kernel)) {