implement teardown

This commit is contained in:
Joey Hess 2014-11-21 14:37:19 -04:00
parent 36e89cd148
commit fbce215f33
1 changed files with 11 additions and 3 deletions

View File

@ -3,6 +3,7 @@ module Propellor.Property.Systemd (
started, started,
stopped, stopped,
enabled, enabled,
disabled,
persistentJournal, persistentJournal,
Container, Container,
container, container,
@ -50,6 +51,11 @@ enabled :: ServiceName -> Property
enabled n = trivial $ cmdProperty "systemctl" ["enable", n] enabled n = trivial $ cmdProperty "systemctl" ["enable", n]
`describe` ("service " ++ n ++ " enabled") `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. -- | Enables persistent storage of the journal.
persistentJournal :: Property persistentJournal :: Property
persistentJournal = check (not <$> doesDirectoryExist dir) $ persistentJournal = check (not <$> doesDirectoryExist dir) $
@ -121,10 +127,12 @@ nspawnService (Container name _ _) = RevertableProperty setup teardown
servicefile = "/etc/systemd/system/multi-user.target.wants" </> service servicefile = "/etc/systemd/system/multi-user.target.wants" </> service
setup = check (not <$> doesFileExist servicefile) $ setup = check (not <$> doesFileExist servicefile) $
started service started service
`requires` enabled 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 -- | Installs a "enter-machinename" script that root can use to run a
-- command inside the container. -- command inside the container.