Re: [pve-devel] [RFC v2] Use JSONSchema to parse vzdump config

2015-07-27 Thread Wolfgang Bumiller
On Mon, Jul 27, 2015 at 12:07:41PM +0200, Michael Rasmussen wrote: On Mon, 27 Jul 2015 11:42:57 +0200 Wolfgang Bumiller w.bumil...@proxmox.com wrote: The `= undef;` part shouldn't be necessary as that's implicit. We seem to mostly leave it out in our code as far as I can tell. This

Re: [pve-devel] [RFC v2] Use JSONSchema to parse vzdump config

2015-07-27 Thread Michael Rasmussen
On Mon, 27 Jul 2015 11:42:57 +0200 Wolfgang Bumiller w.bumil...@proxmox.com wrote: The `= undef;` part shouldn't be necessary as that's implicit. We seem to mostly leave it out in our code as far as I can tell. This is a legacy for all old Perl coders back from the days where variables

Re: [pve-devel] [RFC v2] Use JSONSchema to parse vzdump config

2015-07-27 Thread Wolfgang Bumiller
-my $res = { +my $defaults = { (...) +foreach my $key (keys %$defaults) { + $res-{$key} = $defaults-{$key} if !$res-{$key}; +} I wonder if this is actually even necessary as parse_config should simply override old keys. + local $/ = undef; The `= undef;` part

[pve-devel] [RFC v2] Use JSONSchema to parse vzdump config

2015-07-27 Thread Thomas Lamprecht
Instead of a lot of hardcoded if's use JSONSchema::parse_config to parse and validate vzdump.conf. To do that $confdesc was extended to match a valid schema. Signed-off-by: Thomas Lamprecht t.lampre...@proxmox.com --- PVE/VZDump.pm | 58 +-