propellor spin
This commit is contained in:
parent
6c0746b607
commit
6cdd37d9ff
|
@ -89,7 +89,6 @@ meow :: Systemd.Container
|
|||
meow = Systemd.container "meow" (Chroot.debootstrapped (System (Debian Unstable) "amd64") mempty)
|
||||
& Apt.serviceInstalledRunning "uptimed"
|
||||
& alias "meow.kitenet.net"
|
||||
-- & Systemd.containerCfg "private-network"
|
||||
|
||||
testChroot :: Chroot.Chroot
|
||||
testChroot = Chroot.debootstrapped (System (Debian Unstable) "amd64") mempty "/tmp/chroot"
|
||||
|
|
|
@ -10,6 +10,7 @@ module Propellor.Property.Systemd (
|
|||
container,
|
||||
nspawned,
|
||||
containerCfg,
|
||||
resolvConfed,
|
||||
) where
|
||||
|
||||
import Propellor
|
||||
|
@ -30,6 +31,7 @@ type ServiceName = String
|
|||
type MachineName = String
|
||||
|
||||
data Container = Container MachineName Chroot.Chroot Host
|
||||
deriving (Show)
|
||||
|
||||
instance Hostlike Container where
|
||||
(Container n c h) & p = Container n c (h & p)
|
||||
|
@ -166,7 +168,7 @@ nspawnService (Container name _ _) cfg = RevertableProperty setup teardown
|
|||
disabled service `requires` stopped service
|
||||
|
||||
nspawnServiceParams :: ChrootCfg -> [String]
|
||||
nspawnServiceParams ChrootCfg = []
|
||||
nspawnServiceParams NoChrootCfg = []
|
||||
nspawnServiceParams (SystemdNspawnCfg ps) =
|
||||
M.keys $ M.filter id $ M.fromList ps
|
||||
|
||||
|
@ -220,7 +222,7 @@ mungename = replace "/" "_"
|
|||
containerCfg :: String -> RevertableProperty
|
||||
containerCfg p = RevertableProperty (mk True) (mk False)
|
||||
where
|
||||
mk b = pureInfoProperty ("container configured " ++ if b then "with " else "without " ++ p') $
|
||||
mk b = pureInfoProperty ("container configuration " ++ (if b then "" else "without ") ++ p') $
|
||||
mempty { _chrootinfo = mempty { _chrootCfg = SystemdNspawnCfg [(p', b)] } }
|
||||
p' = case p of
|
||||
('-':_) -> p
|
||||
|
|
|
@ -17,13 +17,13 @@ instance Monoid (ChrootInfo host) where
|
|||
}
|
||||
|
||||
data ChrootCfg
|
||||
= ChrootCfg
|
||||
= NoChrootCfg
|
||||
| SystemdNspawnCfg [(String, Bool)]
|
||||
deriving (Show)
|
||||
|
||||
instance Monoid ChrootCfg where
|
||||
mempty = ChrootCfg
|
||||
mappend _ ChrootCfg = ChrootCfg
|
||||
mappend ChrootCfg r = r
|
||||
mempty = NoChrootCfg
|
||||
mappend v NoChrootCfg = v
|
||||
mappend NoChrootCfg v = v
|
||||
mappend (SystemdNspawnCfg l1) (SystemdNspawnCfg l2) =
|
||||
SystemdNspawnCfg (l1 <> l2)
|
||||
|
|
Loading…
Reference in New Issue