Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com>
---
 PVE/Status/InfluxDB.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PVE/Status/InfluxDB.pm b/PVE/Status/InfluxDB.pm
index e5dfca39..712a30ff 100644
--- a/PVE/Status/InfluxDB.pm
+++ b/PVE/Status/InfluxDB.pm
@@ -207,6 +207,11 @@ sub test_connection {
        my $url = "${proto}://${host}:${port}/health";
        my $ua = LWP::UserAgent->new();
        $ua->timeout($cfg->{timeout} // 1);
+       # in the initial add connection test, the token may still be in $cfg
+       my $token = $cfg->{token} // get_credentials($id);
+       if (defined($token)) {
+           $ua->default_header("Authorization" => "Token $token");
+       }
        my $response = $ua->get($url);
 
        if (!$response->is_success) {
-- 
2.29.2



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

Reply via email to