[pve-devel] [PATCH pve-container 7/7] warn when trying to delete non-existent options

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Nov 25 15:25:17 CET 2015


Otherwise this runs through the code causing all kinds of
different errors like use of uninitialized values in
peculiar places or format errors trying to validate empty
string or 'missing property' errors trying to parse empty
property strings...
---
 src/PVE/LXC.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 2858b6c..a003746 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1226,6 +1226,11 @@ sub update_pct_config {
 
     if (defined($delete)) {
 	foreach my $opt (@$delete) {
+	    if (!exists($conf->{$opt})) {
+		warn "no such option: $opt\n";
+		next;
+	    }
+
 	    if ($opt eq 'hostname' || $opt eq 'memory' || $opt eq 'rootfs') {
 		die "unable to delete required option '$opt'\n";
 	    } elsif ($opt eq 'swap') {
-- 
2.1.4





More information about the pve-devel mailing list