[pve-devel] [PATCH manager] fix #1326: allow multiple status server definitions per type
Dominik Csapak
d.csapak at proxmox.com
Wed Apr 10 14:49:00 CEST 2019
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 at 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
More information about the pve-devel
mailing list