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