summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/Chroot.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-06 08:19:02 -0700
committerJoey Hess2015-09-06 16:13:54 -0400
commitdef53b64cc17b95eb5729dd97a800dfe1257b352 (patch)
tree03f63e5bcb6486b00639e1ea78c21d8928c3b8ca /src/Propellor/Types/Chroot.hs
parent6f4024f5307a81f26f5e6bf86b84c7363219cb3d (diff)
Added Propellor.Property.Rsync. WIP; untested
Convert Info to use Data.Dynamic, so properties can export and consume info of any type that is Typeable and a Monoid, including data types private to a module. (API change) Thanks to Joachim Breitner for the idea.
Diffstat (limited to 'src/Propellor/Types/Chroot.hs')
-rw-r--r--src/Propellor/Types/Chroot.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/Propellor/Types/Chroot.hs b/src/Propellor/Types/Chroot.hs
index d37d34c7..d92c7070 100644
--- a/src/Propellor/Types/Chroot.hs
+++ b/src/Propellor/Types/Chroot.hs
@@ -1,23 +1,31 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+
module Propellor.Types.Chroot where
+import Propellor.Types
+import Propellor.Types.Empty
+import Propellor.Types.Info
+
import Data.Monoid
import qualified Data.Map as M
-import Propellor.Types.Empty
-data ChrootInfo host = ChrootInfo
- { _chroots :: M.Map FilePath host
+data ChrootInfo = ChrootInfo
+ { _chroots :: M.Map FilePath Host
, _chrootCfg :: ChrootCfg
}
- deriving (Show)
+ deriving (Show, Typeable)
+
+instance IsInfo ChrootInfo where
+ propigateInfo _ = False
-instance Monoid (ChrootInfo host) where
+instance Monoid ChrootInfo where
mempty = ChrootInfo mempty mempty
mappend old new = ChrootInfo
{ _chroots = M.union (_chroots old) (_chroots new)
, _chrootCfg = _chrootCfg old <> _chrootCfg new
}
-instance Empty (ChrootInfo host) where
+instance Empty ChrootInfo where
isEmpty i = and
[ isEmpty (_chroots i)
, isEmpty (_chrootCfg i)