summaryrefslogtreecommitdiff
path: root/src/Propellor/Types.hs
diff options
context:
space:
mode:
authorJoey Hess2014-11-20 14:06:55 -0400
committerJoey Hess2014-11-20 14:15:26 -0400
commitb8b746a7f1bdbf179136959a85138fde60c43588 (patch)
tree48e9b5c95a7f0ec1ef0f899513e65de96124c31a /src/Propellor/Types.hs
parentcc8bbcf95b9b0cdcd2db17ee6049263498caa79b (diff)
starting work on a Chroot module
factored out info up-propigation code rom Docker
Diffstat (limited to 'src/Propellor/Types.hs')
-rw-r--r--src/Propellor/Types.hs21
1 files changed, 20 insertions, 1 deletions
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)
+ ]