From 6cdd37d9ff3ff3e3b8439445c1363b9bdc77a5da Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Nov 2014 20:53:38 -0400 Subject: propellor spin --- config-joey.hs | 1 - src/Propellor/Property/Systemd.hs | 6 ++++-- src/Propellor/Types/Chroot.hs | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config-joey.hs b/config-joey.hs index b66a1183..2971c1a2 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -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" diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs index 554e6b20..a2130a21 100644 --- a/src/Propellor/Property/Systemd.hs +++ b/src/Propellor/Property/Systemd.hs @@ -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 diff --git a/src/Propellor/Types/Chroot.hs b/src/Propellor/Types/Chroot.hs index 7e7c3630..b7ed7807 100644 --- a/src/Propellor/Types/Chroot.hs +++ b/src/Propellor/Types/Chroot.hs @@ -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) -- cgit v1.2.3