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.csa...@proxmox.com>
---
 PVE/Status/Plugin.pm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/PVE/Status/Plugin.pm b/PVE/Status/Plugin.pm
index ff7af896..d348699f 100644
--- a/PVE/Status/Plugin.pm
+++ b/PVE/Status/Plugin.pm
@@ -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;
 }
-- 
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to