http client: suppress "storing login ticket"-error when not using a TTY

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@proxmox.com>
This commit is contained in:
Fiona Ebner 2023-01-05 11:19:32 +01:00 committed by Wolfgang Bumiller
parent a2055c38fe
commit 73809d55b7

View File

@ -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;