fix #4346: pbs-client: don't fail silently when storing ticket

Instead, report an error if storing the ticket info failed, so that the
user is informed that something went wrong and follow-up commands might
require authentication again.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
This commit is contained in:
Christoph Heiss 2022-12-12 15:10:56 +01:00 committed by Wolfgang Bumiller
parent f72ccdd65d
commit 70b22b624d

View File

@ -451,13 +451,15 @@ impl HttpClient {
{
Ok(auth) => {
if use_ticket_cache && prefix2.is_some() {
let _ = store_ticket_info(
if let Err(err) = store_ticket_info(
prefix2.as_ref().unwrap(),
&server2,
&auth.auth_id.to_string(),
&auth.ticket,
&auth.token,
);
) {
log::error!("storing login ticket failed: {}", err);
}
}
*auth2.write().unwrap() = auth;
}
@ -485,13 +487,15 @@ impl HttpClient {
move |auth| {
if use_ticket_cache && prefix.is_some() {
let _ = store_ticket_info(
if let Err(err) = store_ticket_info(
prefix.as_ref().unwrap(),
&server,
&auth.auth_id.to_string(),
&auth.ticket,
&auth.token,
);
) {
log::error!("storing login ticket failed: {}", err);
}
}
*authinfo.write().unwrap() = auth;
tokio::spawn(renewal_future);