[pbs-devel] [PATCH proxmox-backup] http client: suppress "storing login ticket"-error when not using a TTY

Fiona Ebner f.ebner at proxmox.com
Thu Jan 5 11:19:32 CET 2023


as a stop-gap measure. Otherwise, task logs for PVE backups started
via non-CLI will have the message
> storing login ticket failed: $XDG_RUNTIME_DIR must be set
show up when running a proxmox-backup-client command (e.g. setting
notes and when uploading the log). This is confusing to users[0].

[0]: https://forum.proxmox.com/threads/120492/

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 pbs-client/src/http_client.rs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs
index 1317517f..d9f6b7af 100644
--- a/pbs-client/src/http_client.rs
+++ b/pbs-client/src/http_client.rs
@@ -458,7 +458,9 @@ impl HttpClient {
                                 &auth.ticket,
                                 &auth.token,
                             ) {
-                                log::error!("storing login ticket failed: {}", err);
+                                if tty::stdout_isatty() {
+                                    log::error!("storing login ticket failed: {}", err);
+                                }
                             }
                         }
                         *auth2.write().unwrap() = auth;
@@ -494,7 +496,9 @@ impl HttpClient {
                         &auth.ticket,
                         &auth.token,
                     ) {
-                        log::error!("storing login ticket failed: {}", err);
+                        if tty::stdout_isatty() {
+                            log::error!("storing login ticket failed: {}", err);
+                        }
                     }
                 }
                 *authinfo.write().unwrap() = auth;
-- 
2.30.2






More information about the pbs-devel mailing list