implement teardown
This commit is contained in:
parent
36e89cd148
commit
fbce215f33
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue