From 95a4456d9862cb37cac76de5eae6ba2fc76c782b Mon Sep 17 00:00:00 2001 From: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com> Date: Fri, 6 Jun 2025 13:29:30 +0200 Subject: [PATCH] fix(apps::backup::rubrik::restapi): api token not cleaned and renewed (#5344) Co-authored-by: Sylvain Cresto Refs:CTOR-729 --- src/apps/backup/rubrik/restapi/custom/api.pm | 10 ++++++++++ tests/resources/spellcheck/stopwords.txt | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/apps/backup/rubrik/restapi/custom/api.pm b/src/apps/backup/rubrik/restapi/custom/api.pm index 11059959a..f180378ec 100644 --- a/src/apps/backup/rubrik/restapi/custom/api.pm +++ b/src/apps/backup/rubrik/restapi/custom/api.pm @@ -317,6 +317,11 @@ sub request_api_paginate { $self->{output}->option_exit(); } + if ($self->{http}->get_code() == 401) { + $self->{output}->add_option_msg(short_msg => "Request needs authentication!"); + return + } + my $decoded; eval { $decoded = JSON::XS->new->allow_nonref(1)->utf8->decode($content); @@ -375,6 +380,11 @@ sub request_api { ); } + if ($self->{http}->get_code() == 401) { + $self->{output}->add_option_msg(short_msg => "Authentication failed"); + $self->{output}->option_exit(); + } + return $result; } diff --git a/tests/resources/spellcheck/stopwords.txt b/tests/resources/spellcheck/stopwords.txt index 0f74fba7a..340cf6e92 100644 --- a/tests/resources/spellcheck/stopwords.txt +++ b/tests/resources/spellcheck/stopwords.txt @@ -234,6 +234,8 @@ RRDCached rsrp rsrq rssi +Rubrik +µs Sansymphony SAS scenarii @@ -245,7 +247,6 @@ sinr SkyHigh SMS SnapMirrors -SnapMirrors snmp snmpd.conf space-usage-prct @@ -256,8 +257,8 @@ standAlone statefile --statefile-concat-cwd Stormshield -SureBackup superseed +SureBackup systemd SysVol TCP @@ -282,7 +283,6 @@ UninterrupibleSleep uniq uptime --urlpath -µs usage-prct usec userpass