MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _read_openshell_log

Function _read_openshell_log

e2e/python/test_sandbox_policy.py:177–198  ·  view source on GitHub ↗

Return a closure that reads the openshell log file(s). Since the sandbox uses a rolling file appender, logs are written to date-stamped files like ``/var/log/openshell.YYYY-MM-DD.log`` instead of a single ``/var/log/openshell.log``. This helper globs for all matching files so tests

()

Source from the content-addressed store, hash-verified

175
176
177def _read_openshell_log():
178 """Return a closure that reads the openshell log file(s).
179
180 Since the sandbox uses a rolling file appender, logs are written to
181 date-stamped files like ``/var/log/openshell.YYYY-MM-DD.log`` instead
182 of a single ``/var/log/openshell.log``. This helper globs for all
183 matching files so tests work with both the legacy and rolling layouts.
184 """
185
186 def fn():
187 import glob
188
189 logs = []
190 for path in sorted(glob.glob("/var/log/openshell*.log*")):
191 try:
192 with open(path) as f:
193 logs.append(f.read())
194 except (FileNotFoundError, PermissionError):
195 pass
196 return "\n".join(logs)
197
198 return fn
199
200
201def _forward_proxy_with_server():

Calls

no outgoing calls

Tested by

no test coverage detected