mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
v2v: bootloaders: Handle no Bootloader::Tools default section (RHBZ#1472208).
In SUSE guests, handle the case where Bootloader::Tools::GetDefaultSection () returns undef. Previously this would return an empty string and cause a bogus error in subsequent code: virt-v2v: error: libguestfs error: statns: statns_stub: path must start with a / character
This commit is contained in:
@@ -287,10 +287,21 @@ object (self)
|
||||
let cmd =
|
||||
[| "/usr/bin/perl"; "-MBootloader::Tools"; "-e"; "
|
||||
InitLibrary();
|
||||
my $default = Bootloader::Tools::GetDefaultSection();
|
||||
print $default->{image};
|
||||
my $default = Bootloader::Tools::GetDefaultSection ();
|
||||
if (!defined $default) {
|
||||
print 'NODEFAULTSECTION'
|
||||
}
|
||||
elsif (exists $default->{image}) {
|
||||
print $default->{image}
|
||||
}
|
||||
else {
|
||||
die 'no $default->{image}' # should never happen
|
||||
}
|
||||
" |] in
|
||||
Some (g#command cmd)
|
||||
let res = g#command cmd in
|
||||
(match res with
|
||||
| "NODEFAULTSECTION" -> None
|
||||
| _ -> Some res)
|
||||
| MethodNone ->
|
||||
None in
|
||||
match res with
|
||||
|
||||
Reference in New Issue
Block a user