public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] fix #4346: pbs-client: don't fail silently when storing ticket
Date: Mon, 12 Dec 2022 15:10:56 +0100	[thread overview]
Message-ID: <20221212141056.180468-1-c.heiss@proxmox.com> (raw)

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>
---
 pbs-client/src/http_client.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs
index c78d08f3..256b3cfa 100644
--- a/pbs-client/src/http_client.rs
+++ b/pbs-client/src/http_client.rs
@@ -452,13 +452,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;
                     }
@@ -486,13 +488,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);
-- 
2.30.2





             reply	other threads:[~2022-12-12 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 14:10 Christoph Heiss [this message]
2022-12-13 13:39 ` [pbs-devel] applied: " Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221212141056.180468-1-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal