vzdump: generate notes: initialize potentially undef values

For VMs, $task->{hostname} might be undef and when running on a
stand-alone node, there is no cluster name.

Reported-by: Marco Gabriel <mgabriel@inett.de>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2022-05-09 12:34:09 +02:00 committed by Thomas Lamprecht
parent facf65a6e0
commit 2078e35988

View File

@ -97,8 +97,8 @@ my $generate_notes = sub {
$verify_notes_template->($notes_template);
my $info = {
cluster => PVE::Cluster::get_clinfo()->{cluster}->{name},
guestname => $task->{hostname},
cluster => PVE::Cluster::get_clinfo()->{cluster}->{name} // 'standalone node',
guestname => $task->{hostname} // "VM $task->{vmid}", # is always set for CTs
node => PVE::INotify::nodename(),
vmid => $task->{vmid},
};