[pve-devel] [PATCH container] api: add option to get pending config returned as object instead of an array
Tim Marx
t.marx at proxmox.com
Wed May 20 14:23:42 CEST 2020
Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
src/PVE/API2/LXC.pm | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 21899d0..7b91b6f 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1914,10 +1914,17 @@ __PACKAGE__->register_method({
properties => {
node => get_standard_option('pve-node'),
vmid => get_standard_option('pve-vmid', { completion => \&PVE::LXC::complete_ctid }),
+ object => {
+ description => "In this case the root element is an object instead of an array.".
+ "The key property of the items will be extracted and used as the root object keys.",
+ optional => 1,
+ default => 0,
+ type => 'boolean',
+ },
},
},
returns => {
- type => "array",
+ type => [ "array", "object"],
items => {
type => "object",
properties => {
@@ -1952,7 +1959,7 @@ __PACKAGE__->register_method({
my $pending_delete_hash = PVE::LXC::Config->parse_pending_delete($conf->{pending}->{delete});
- return PVE::GuestHelpers::config_with_pending_array($conf, $pending_delete_hash);
+ return PVE::GuestHelpers::config_with_pending($conf, $pending_delete_hash, $param->{object});
}});
1;
--
2.20.1
More information about the pve-devel
mailing list