From b8b746a7f1bdbf179136959a85138fde60c43588 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 20 Nov 2014 14:06:55 -0400 Subject: starting work on a Chroot module factored out info up-propigation code rom Docker --- src/Propellor/Types.hs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Types.hs') diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs index 90c08e64..4e0a8dee 100644 --- a/src/Propellor/Types.hs +++ b/src/Propellor/Types.hs @@ -25,6 +25,7 @@ module Propellor.Types , fromVal , DockerInfo(..) , DockerRunParam(..) + , ChrootInfo(..) , module Propellor.Types.OS , module Propellor.Types.Dns ) where @@ -166,11 +167,12 @@ data Info = Info , _dns :: S.Set Dns.Record , _namedconf :: Dns.NamedConfMap , _dockerinfo :: DockerInfo + , _chrootinfo :: ChrootInfo } deriving (Eq, Show) instance Monoid Info where - mempty = Info mempty mempty mempty mempty mempty mempty mempty + mempty = Info mempty mempty mempty mempty mempty mempty mempty mempty mappend old new = Info { _os = _os old <> _os new , _privDataFields = _privDataFields old <> _privDataFields new @@ -179,6 +181,7 @@ instance Monoid Info where , _dns = _dns old <> _dns new , _namedconf = _namedconf old <> _namedconf new , _dockerinfo = _dockerinfo old <> _dockerinfo new + , _chrootinfo = _chrootinfo old <> _chrootinfo new } data Val a = Val a | NoVal @@ -217,3 +220,19 @@ newtype DockerRunParam = DockerRunParam (HostName -> String) instance Show DockerRunParam where show (DockerRunParam a) = a "" + +data ChrootInfo = ChrootInfo + { _chroots :: M.Map FilePath Host + } + deriving (Show) + +instance Monoid ChrootInfo where + mempty = ChrootInfo mempty + mappend old new = ChrootInfo + { _chroots = M.union (_chroots old) (_chroots new) + } + +instance Eq ChrootInfo where + x == y = and + [ M.keys (_chroots x) == M.keys (_chroots y) + ] -- cgit v1.2.3