]> git.proxmox.com Git - pve-guest-common.git/commitdiff
replace complete_snapshot_name with snapshot_list
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 3 Jan 2019 09:09:45 +0000 (10:09 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 3 Jan 2019 09:22:26 +0000 (10:22 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
PVE/AbstractConfig.pm

index 12086b1c95153ef68d8e78f3a2c2d0300904661a..e0d0f10af44c890d84df3d019222d1d3040439aa 100644 (file)
@@ -699,13 +699,14 @@ sub snapshot_rollback {
 
 # bash completion helper
 
-sub complete_snapshot_name {
-    my ($class) = @_;
-    my $vmid = $_[4][0];
-
-    my $conf = $class->load_config($vmid);
+sub snapshot_list {
+    my ($class, $vmid) = @_;
 
-    my $snapshot = [ keys %{$conf->{snapshots}} ];
+    my $snapshot = eval {
+       my $conf = $class->load_config($vmid);
+       my $snapshots = $conf->{snapshots} || [];
+       [ sort keys %$snapshots ]
+    } || [];
 
     return $snapshot;
 }