]> git.proxmox.com Git - pve-cluster.git/commitdiff
datacenter.cfg: parse/print u2f property string
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 11 Nov 2019 10:28:02 +0000 (11:28 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Nov 2019 09:39:51 +0000 (10:39 +0100)
when parsing config, like other property strings stored in this file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
data/PVE/DataCenterConfig.pm

index 5f3f80a6d73f01d120763c8fd904c5a6d5ea5f82..77cc73cee2b75c3f97d3023c5beaab88503f1443 100644 (file)
@@ -35,7 +35,7 @@ my $ha_format = {
     }
 };
 
-our $u2f_format = {
+my $u2f_format = {
     appid => {
        type => 'string',
        description => "U2F AppId URL override. Defaults to the origin.",
@@ -184,6 +184,10 @@ sub parse_datacenter_config {
        $res->{ha} = PVE::JSONSchema::parse_property_string($ha_format, $ha);
     }
 
+    if (my $u2f = $res->{u2f}) {
+       $res->{u2f} = PVE::JSONSchema::parse_property_string($u2f_format, $u2f);
+    }
+
     # for backwards compatibility only, new migration property has precedence
     if (defined($res->{migration_unsecure})) {
        if (defined($res->{migration}->{type})) {
@@ -226,6 +230,11 @@ sub write_datacenter_config {
        $cfg->{ha} = PVE::JSONSchema::print_property_string($ha, $ha_format);
     }
 
+    if (ref($cfg->{u2f})) {
+       my $u2f = $cfg->{u2f};
+       $cfg->{u2f} = PVE::JSONSchema::print_property_string($u2f, $u2f_format);
+    }
+
     return PVE::JSONSchema::dump_config($datacenter_schema, $filename, $cfg);
 }