]> git.proxmox.com Git - pve-container.git/commitdiff
warn when trying to delete non-existent options
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 25 Nov 2015 14:25:17 +0000 (15:25 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 26 Nov 2015 11:20:47 +0000 (12:20 +0100)
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

index ec2d69ffb426692c566da69f1d8a69ef055bd7c8..594a5ce7d71aabd717f32647ea3f764cc70a4438 100644 (file)
@@ -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') {