remote exceptions: simplify sysinfo processing

in the sysinfo function, there is a way to suppress
all sysinfo output via an env var and just return an
empty string.

so we can expect it is always in unpacked, but it
might be the empty string.
This commit is contained in:
Thomas Waldmann 2023-05-24 15:29:59 +02:00
parent 2331341b74
commit 90c6b7f794
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
1 changed files with 4 additions and 3 deletions

View File

@ -209,6 +209,7 @@ class RepositoryServer: # pragma: no cover
else: else:
logging.debug("\n".join(ex_full)) logging.debug("\n".join(ex_full))
sys_info = sysinfo()
try: try:
msg = msgpack.packb( msg = msgpack.packb(
{ {
@ -218,7 +219,7 @@ class RepositoryServer: # pragma: no cover
"exception_full": ex_full, "exception_full": ex_full,
"exception_short": ex_short, "exception_short": ex_short,
"exception_trace": ex_trace, "exception_trace": ex_trace,
"sysinfo": sysinfo(), "sysinfo": sys_info,
} }
) )
except TypeError: except TypeError:
@ -230,7 +231,7 @@ class RepositoryServer: # pragma: no cover
"exception_full": ex_full, "exception_full": ex_full,
"exception_short": ex_short, "exception_short": ex_short,
"exception_trace": ex_trace, "exception_trace": ex_trace,
"sysinfo": sysinfo(), "sysinfo": sys_info,
} }
) )
@ -438,7 +439,7 @@ class RemoteRepository:
@property @property
def sysinfo(self): def sysinfo(self):
return self.unpacked.get("sysinfo", "") return self.unpacked["sysinfo"]
class RPCServerOutdated(Error): class RPCServerOutdated(Error):
"""Borg server is too old for {}. Required version {}""" """Borg server is too old for {}. Required version {}"""