]> git.proxmox.com Git - pve-zsync.git/commitdiff
fix #910: Correctly handle undef
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 9 Mar 2016 11:39:54 +0000 (12:39 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Mar 2016 13:43:40 +0000 (14:43 +0100)
pve-zsync

index d517ece39fef9902e3550d142b1a7f509900996a..5fecbc2883abfd2fd697ab3ad6ff712a3f733096 100644 (file)
--- a/pve-zsync
+++ b/pve-zsync
@@ -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;