]> git.proxmox.com Git - pve-common.git/commitdiff
SectionConfig: always write out explicitly set booleans
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 12 Oct 2016 09:35:19 +0000 (11:35 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 18 Oct 2016 08:50:04 +0000 (10:50 +0200)
Because when only writing the ones which are true we're
breaking the ones which default to true (like the mkdir
option on directory storages, where we need a false value
to be written out explicitly).

src/PVE/SectionConfig.pm

index 3030f6018e024d804de705f3c29c204e6613f160..a6301e262598d0ee7886144ec104cb51301e5b24 100644 (file)
@@ -400,7 +400,8 @@ my $format_config_line = sub {
        if ($key =~ m/[\n\r]/) || ($value =~ m/[\n\r]/);
 
     if ($ct eq 'boolean') {
        if ($key =~ m/[\n\r]/) || ($value =~ m/[\n\r]/);
 
     if ($ct eq 'boolean') {
-       return $value ? "\t$key\n" : '';
+       return "\t$key " . ($value ? 1 : 0) . "\n"
+           if defined($value);
     } else {
        return "\t$key $value\n" if "$value" ne '';
     }
     } else {
        return "\t$key $value\n" if "$value" ne '';
     }