Forráskód Böngészése

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.
Thomas Waldmann 2 éve
szülő
commit
90c6b7f794
1 módosított fájl, 4 hozzáadás és 3 törlés
  1. 4 3
      src/borg/remote.py

+ 4 - 3
src/borg/remote.py

@@ -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 {}"""