]> git.proxmox.com Git - pve-manager.git/commitdiff
fix #1326: allow multiple status server definitions per type
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 10 Apr 2019 12:49:00 +0000 (14:49 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 11 Apr 2019 06:11:43 +0000 (08:11 +0200)
we allow an id like storage.cfg but leave it optional (so we do not
break existing configs):

 influxdb: name

so that one can export the data to multiple servers of the same type

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/Status/Plugin.pm

index ff7af896ab3f9d5f4ddf53a55e9574096005addf..d348699ff3c1995d6d435978543a6a84399d279d 100644 (file)
@@ -44,13 +44,17 @@ sub private {
 sub parse_section_header {
     my ($class, $line) = @_;
 
-    if ($line =~ m/^(\S+):\s*$/) {
+    if ($line =~ m/^(\S+):\s*(\S+)?\s*$/) {
        my $type = lc($1);
+       my $id = $2 // $type;
        my $errmsg = undef; # set if you want to skip whole section
-       eval { PVE::JSONSchema::pve_verify_configid($type); };
+       eval {
+           PVE::JSONSchema::pve_verify_configid($type);
+           PVE::JSONSchema::pve_verify_configid($id);
+       };
        $errmsg = $@ if $@;
        my $config = {}; # to return additional attributes
-       return ($type, $type, $errmsg, $config);
+       return ($type, $id, $errmsg, $config);
     }
     return undef;
 }