From fbce215f3381b36df64c0e268bb816b1b0a4fd0d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Nov 2014 14:37:19 -0400 Subject: implement teardown --- src/Propellor/Property/Systemd.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs index c6f57e23..ce7d63c1 100644 --- a/src/Propellor/Property/Systemd.hs +++ b/src/Propellor/Property/Systemd.hs @@ -3,6 +3,7 @@ module Propellor.Property.Systemd ( started, stopped, enabled, + disabled, persistentJournal, Container, container, @@ -50,6 +51,11 @@ enabled :: ServiceName -> Property enabled n = trivial $ cmdProperty "systemctl" ["enable", n] `describe` ("service " ++ n ++ " enabled") +-- | Disables a systemd service. +disabled :: ServiceName -> Property +disabled n = trivial $ cmdProperty "systemctl" ["distable", n] + `describe` ("service " ++ n ++ " disabled") + -- | Enables persistent storage of the journal. persistentJournal :: Property persistentJournal = check (not <$> doesDirectoryExist dir) $ @@ -121,10 +127,12 @@ nspawnService (Container name _ _) = RevertableProperty setup teardown servicefile = "/etc/systemd/system/multi-user.target.wants" service setup = check (not <$> doesFileExist servicefile) $ - started service - `requires` enabled service + started service + `requires` enabled service - teardown = undefined + teardown = check (doesFileExist servicefile) $ + disabled service + `requires` stopped service -- | Installs a "enter-machinename" script that root can use to run a -- command inside the container. -- cgit v1.2.3