Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #25 from wolsen/check-symlink-exists
Browse files Browse the repository at this point in the history
Check symlink exists prior to creating symlinks
  • Loading branch information
jamesbeedy authored Aug 23, 2023
2 parents 3c8859a + 167fb80 commit add9c92
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/charms/hpc_libs/v0/juju_systemd_notices.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ def subscribe(self) -> None:
"""Subscribe charmed operator to observe status of systemd services."""
_logger.debug(f"Generating systemd notice hooks for {self._services}")
for service in self._services:
Path(f"hooks/service-{service}-started").symlink_to(f"{Path.cwd()}/dispatch")
Path(f"hooks/service-{service}-stopped").symlink_to(f"{Path.cwd()}/dispatch")
for hook in {"started", "stopped"}:
hook = Path(f"hooks/service-{service}-{hook}")
if not hook.exists():
hook.symlink_to(f"{Path.cwd()}/dispatch")

_logger.debug(f"Starting {self._service_file.name} daemon")
if self._service_file.exists():
Expand Down

0 comments on commit add9c92

Please sign in to comment.