]> git.proxmox.com Git - pve-container.git/commitdiff
config list helper: fix return type of vmid for container index API enpoint
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 5 Dec 2023 11:35:32 +0000 (12:35 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 11 Apr 2024 13:28:29 +0000 (15:28 +0200)
The schema declares it to be an integer. Done in the config_list()
helper, to ensure consistency for the following existing code in
vmstatus():

> my $list = $opt_vmid ? { $opt_vmid => { type => 'lxc', vmid => int($opt_vmid) }} : config_list();

Should not cause any issues for other callers of the helper.

Reported in the community forum:
https://forum.proxmox.com/threads/137628/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
src/PVE/LXC.pm

index 88a9d6f17fbdde89a1cf80a0e261ec6e58e4d64e..0dda6966ecd7df02c77c9d1541bed47faaf1eef0 100644 (file)
@@ -69,7 +69,7 @@ sub config_list {
        my $d = $ids->{$vmid};
        next if !$d->{node} || $d->{node} ne $nodename;
        next if !$d->{type} || $d->{type} ne 'lxc';
-       $res->{$vmid} = { type => 'lxc', vmid => $vmid };
+       $res->{$vmid} = { type => 'lxc', vmid => int($vmid) };
     }
     return $res;
 }