[pve-devel] [PATCH qemu-server] fix #3792: cloudinit: use of uninitialized value

Mira Limbeck m.limbeck at proxmox.com
Mon Dec 20 15:03:59 CET 2021


With the patch adding vendor-data support to cloud-init, a use of
uninitialized value was introduced. This can be fixed by setting it to
an empty string if no vendor-data is defined.

vendor-data can only be set via --cicustom and is optional.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 PVE/QemuServer/Cloudinit.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
index cc8970c..b7daa2a 100644
--- a/PVE/QemuServer/Cloudinit.pm
+++ b/PVE/QemuServer/Cloudinit.pm
@@ -230,6 +230,7 @@ sub generate_configdrive2 {
     my ($user_data, $network_data, $meta_data, $vendor_data) = get_custom_cloudinit_files($conf);
     $user_data = cloudinit_userdata($conf, $vmid) if !defined($user_data);
     $network_data = configdrive2_network($conf) if !defined($network_data);
+    $vendor_data = '' if !defined($vendor_data);
 
     if (!defined($meta_data)) {
 	$meta_data = configdrive2_gen_metadata($user_data, $network_data);
@@ -486,6 +487,7 @@ sub generate_nocloud {
     my ($user_data, $network_data, $meta_data, $vendor_data) = get_custom_cloudinit_files($conf);
     $user_data = cloudinit_userdata($conf, $vmid) if !defined($user_data);
     $network_data = nocloud_network($conf) if !defined($network_data);
+    $vendor_data = '' if !defined($vendor_data);
 
     if (!defined($meta_data)) {
 	$meta_data = nocloud_gen_metadata($user_data, $network_data);
-- 
2.30.2





More information about the pve-devel mailing list