[pve-devel] [PATCH v2 cluster 08/13] datacenter.cfg: parse/print u2f property string

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Nov 11 11:28:02 CET 2019


when parsing config, like other property strings stored in this file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 data/PVE/DataCenterConfig.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm
index 5f3f80a..77cc73c 100644
--- a/data/PVE/DataCenterConfig.pm
+++ b/data/PVE/DataCenterConfig.pm
@@ -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);
 }
 
-- 
2.20.1





More information about the pve-devel mailing list