From: Dominik Csapak Date: Mon, 23 Jul 2018 10:11:09 +0000 (+0200) Subject: api dump: do not skip indexed params with only one index X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=34d8999638d548e09f4d20707bd41231cef537b1;hp=f4265f248fa5254274e80795f190819bf04b220f api dump: do not skip indexed params with only one index We transform indexed parameters (like scsi0 scsi1 ...) to a single scsi[n]. The check if we should transform did not handle the case where a parameter was indexed but (currently) only index 0 existed. Such definitions where simply skipped and seemed then to miss from places using the API dump, like the api-viewer. We now only skip those parameters with an index > 0 where the same parameter with index 0 is defined. This fixes a missing efidisk0 entry in an API dump[0]. [0]: https://forum.proxmox.com/threads/efidisk0-creation-missing-from-api.45624/ Signed-off-by: Dominik Csapak Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index 5d0c03d..205e6ef 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -37,7 +37,7 @@ sub api_clone_schema { my ($name, $idx) = ($1, $2); if ($idx == 0 && defined($d->{"${name}1"})) { $p = "${name}[n]"; - } elsif (defined($d->{"${name}0"})) { + } elsif ($idx > 0 && defined($d->{"${name}0"})) { next; # only handle once for -xx0, but only if -xx0 exists } }