Skip to content

Commit

Permalink
remote exceptions: simplify sysinfo processing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ThomasWaldmann committed May 24, 2023
1 parent 2331341 commit 90c6b7f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/borg/remote.py
Expand Up @@ -209,6 +209,7 @@ def serve(self):
else:
logging.debug("\n".join(ex_full))

sys_info = sysinfo()
try:
msg = msgpack.packb(
{
Expand All @@ -218,7 +219,7 @@ def serve(self):
"exception_full": ex_full,
"exception_short": ex_short,
"exception_trace": ex_trace,
"sysinfo": sysinfo(),
"sysinfo": sys_info,
}
)
except TypeError:
Expand All @@ -230,7 +231,7 @@ def serve(self):
"exception_full": ex_full,
"exception_short": ex_short,
"exception_trace": ex_trace,
"sysinfo": sysinfo(),
"sysinfo": sys_info,
}
)

Expand Down Expand Up @@ -438,7 +439,7 @@ def exception_full(self):

@property
def sysinfo(self):
return self.unpacked.get("sysinfo", "")
return self.unpacked["sysinfo"]

class RPCServerOutdated(Error):
"""Borg server is too old for {}. Required version {}"""
Expand Down

0 comments on commit 90c6b7f

Please sign in to comment.