Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Jan 19, 2024
1 parent 6c3f862 commit 54baed8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/src/healthstatus/mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def fused(
if logdir is None:
logdir = Path()
with (logdir / "fuse.log").open("wb") as fp:

Check warning on line 51 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L50-L51

Added lines #L50 - L51 were not covered by tests
log.debug("Starting `datalad fusefs` process ...")
with subprocess.Popen(
[
"datalad",
Expand All @@ -66,6 +67,7 @@ def fused(
try:
yield

Check warning on line 68 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L66-L68

Added lines #L66 - L68 were not covered by tests
finally:
log.debug("Terminating `datalad fusefs` process ...")
p.send_signal(SIGINT)

Check warning on line 71 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L71

Added line #L71 was not covered by tests


Expand All @@ -74,6 +76,7 @@ def dandidav(logdir: Path | None = None) -> Iterator[str]:
if logdir is None:
logdir = Path()
with (logdir / "dandidav.log").open("wb") as fp:

Check warning on line 78 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L77-L78

Added lines #L77 - L78 were not covered by tests
log.debug("Starting `dandidav` process ...")
with subprocess.Popen(["dandidav"], stdout=fp, stderr=fp) as p:
try:
url = "http://127.0.0.1:8080"

Check warning on line 82 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L81-L82

Added lines #L81 - L82 were not covered by tests
Expand All @@ -88,18 +91,21 @@ def dandidav(logdir: Path | None = None) -> Iterator[str]:
raise RuntimeError("WebDAV server did not start up time")
yield url

Check warning on line 92 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L91-L92

Added lines #L91 - L92 were not covered by tests
finally:
log.debug("Terminating `dandidav` process ...")
p.send_signal(SIGINT)

Check warning on line 95 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L95

Added line #L95 was not covered by tests


@contextmanager
def webdavfs(url: str, mount_path: str | os.PathLike[str]) -> Iterator[None]:
log.debug("Mounting webdavfs mount ...")
subprocess.run(

Check warning on line 101 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L101

Added line #L101 was not covered by tests
["sudo", "mount", "-t", "webdavfs", url, os.fspath(mount_path)],
check=True,
)
try:
yield

Check warning on line 106 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L105-L106

Added lines #L105 - L106 were not covered by tests
finally:
log.debug("Unmounting webdavfs mount ...")
subprocess.run(["sudo", "umount", os.fspath(mount_path)], check=True)

Check warning on line 109 in code/src/healthstatus/mounts.py

View check run for this annotation

Codecov / codecov/patch

code/src/healthstatus/mounts.py#L109

Added line #L109 was not covered by tests


Expand Down

0 comments on commit 54baed8

Please sign in to comment.