Skip to content

Commit

Permalink
python-bareos: shorten TLS-PSK not available warning
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens authored and BareosBot committed Apr 8, 2024
1 parent 2e27498 commit cd3feae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python-bareos/bareos/bsock/lowlevel.py
Expand Up @@ -54,12 +54,17 @@
# If it is also not available, we continue anyway,
# but don't use TLS-PSK.
if not getattr(ssl, "HAS_PSK", False):

def format_warning_short(message, category, filename, lineno, line=""):
return f"{category.__name__}: {message}\n"

warnings.formatwarning = format_warning_short
try:
import sslpsk
except ImportError:
warnings.warn(
"Connection encryption via TLS-PSK is not available "
"(TLS-PSK is not available in the ssl module and the extra module sslpsk is not installed)."
"(not available in 'ssl' and extra module 'sslpsk' is not installed)."
)


Expand Down

0 comments on commit cd3feae

Please sign in to comment.