Skip to content

Commit

Permalink
Support stop/start systemd calls
Browse files Browse the repository at this point in the history
These changes add the stop/start systemd calls to the service
manager and additionally remove the --now flag from enable and
disable commands.
  • Loading branch information
jamesbeedy committed Dec 4, 2024
1 parent eaa1978 commit 411540c
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions lib/charms/hpc_libs/v0/slurm_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,37 @@ def type(self) -> _ServiceType:
class _SystemctlServiceManager(_ServiceManager):
"""Control a Slurm service using systemctl services."""

def start(self) -> None:
"""Start service.
Raises:
SlurmOpsError: Raised if `systemctl start ...` returns a non-zero returncode.
"""
_systemctl("start", self._service.value)

def stop(self) -> None:
"""Stop service.
Raises:
SlurmOpsError: Raised if `systemctl stop ...` returns a non-zero returncode.
"""
_systemctl("stop", self._service.value)

def enable(self) -> None:
"""Enable service.
Raises:
SlurmOpsError: Raised if `systemctl enable ...` returns a non-zero returncode.
"""
_systemctl("enable", "--now", self._service.value)
_systemctl("enable", self._service.value)

def disable(self) -> None:
"""Disable service."""
_systemctl("disable", "--now", self._service.value)
"""Disable service.
Raises:
SlurmOpsError: Raised if `systemctl disable ...` returns a non-zero returncode.
"""
_systemctl("disable", self._service.value)

def restart(self) -> None:
"""Restart service."""
Expand Down

0 comments on commit 411540c

Please sign in to comment.