]> git.proxmox.com Git - pve-common.git/commit - src/PVE/SectionConfig.pm
SectionConfig: fix handling unknown sections
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 16 Aug 2023 09:09:11 +0000 (11:09 +0200)
committerFiona Ebner <f.ebner@proxmox.com>
Wed, 16 Aug 2023 09:19:26 +0000 (11:19 +0200)
commitd2a6411cab710d1e7b77feb134866e2c0d99b920
treed4412b60f02d2dff314e328ce203b78dee7b838b
parent5738817d17cf363a7d48ccf9f294c2162839d6cc
SectionConfig: fix handling unknown sections

if we're parsing an unknown section, we cannot check the schema with
`is_array` to check if it's an array type or not, thus we have to
handle that separately.

fix this by handling data in unknown sections like an array similar to
"cb2646c7b4974e33f4148752deec71f0d589b0f3" in proxmox-section-config.
This way we can write unknown section out again like we parsed it.

Add a regression test for an unknown field not in the schema.

This fixes an issue, where calling `qm destroy ID --purge` removed much
of the configs ob backup jobs (since there we parse an 'unknown' section
and run into the `is_array` error)
(Reported in the forum: https://forum.proxmox.com/threads/132091)

Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/SectionConfig.pm
test/section_config_test.pl