[pve-devel] [PATCH container 4/4] config: parse: also allow empty values

Fabian Ebner f.ebner at proxmox.com
Wed Mar 3 12:01:28 CET 2021


because they are valid for '-list' formats and it makes the behavior match with
what we do for VM configs. The new pattern is the same that is used for VM
configs. Because it is a non-greedy pattern, trailing whitespaces will not be
included in the value anymore. This /should/ cause no problems and the '\s*$'
at the end suggests that that is how it was intended in the first place.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/PVE/LXC/Config.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 5d223b2..de7e924 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -933,7 +933,7 @@ sub parse_pct_config {
 	    } else {
 		warn "vm $vmid - property 'delete' is only allowed in [pve:pending]\n";
 	    }
-	} elsif ($line =~ m/^([a-z][a-z_]*\d*):\s*(\S.*)\s*$/) {
+	} elsif ($line =~ m/^([a-z][a-z_]*\d*):\s*(.+?)\s*$/) {
 	    my $key = $1;
 	    my $value = $2;
 	    eval { $value = PVE::LXC::Config->check_type($key, $value); };
-- 
2.20.1






More information about the pve-devel mailing list