5
0
mirror of git://git.proxmox.com/git/pve-zsync.git synced 2025-03-11 20:58:42 +03:00

fix #910: Correctly handle undef

This commit is contained in:
Fabian Grünbichler 2016-03-09 12:39:54 +01:00 committed by Dietmar Maurer
parent b56d73fbc2
commit 947c04dcf2

View File

@ -425,7 +425,7 @@ sub list {
$list .= sprintf("%-25s", cut_target_width($name, 25));
$list .= sprintf("%-10s", $states->{$source}->{$name}->{state});
$list .= sprintf("%-20s", $states->{$source}->{$name}->{lsync});
$list .= sprintf("%-6s", $states->{$source}->{$name}->{vm_type});
$list .= sprintf("%-6s", defined($states->{$source}->{$name}->{vm_type}) ? $states->{$source}->{$name}->{vm_type} : "undef");
$list .= sprintf("%-5s\n", $cfg->{$source}->{$name}->{method});
}
}
@ -440,6 +440,8 @@ sub vm_exists {
my $res = undef;
return undef if !defined($target->{vmid});
eval { $res = run_cmd([@cmd, 'ls', "$QEMU_CONF/$target->{vmid}.conf"]) };
return "qemu" if $res;