From def53b64cc17b95eb5729dd97a800dfe1257b352 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Sep 2015 08:19:02 -0700 Subject: 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. --- src/Propellor/Types/Docker.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Types/Docker.hs') diff --git a/src/Propellor/Types/Docker.hs b/src/Propellor/Types/Docker.hs index 3eafa59d..a1ed4cd9 100644 --- a/src/Propellor/Types/Docker.hs +++ b/src/Propellor/Types/Docker.hs @@ -1,25 +1,31 @@ +{-# LANGUAGE DeriveDataTypeable #-} + module Propellor.Types.Docker where -import Propellor.Types.OS +import Propellor.Types import Propellor.Types.Empty +import Propellor.Types.Info import Data.Monoid import qualified Data.Map as M -data DockerInfo h = DockerInfo +data DockerInfo = DockerInfo { _dockerRunParams :: [DockerRunParam] - , _dockerContainers :: M.Map String h + , _dockerContainers :: M.Map String Host } - deriving (Show) + deriving (Show, Typeable) + +instance IsInfo DockerInfo where + propigateInfo _ = False -instance Monoid (DockerInfo h) where +instance Monoid DockerInfo where mempty = DockerInfo mempty mempty mappend old new = DockerInfo { _dockerRunParams = _dockerRunParams old <> _dockerRunParams new , _dockerContainers = M.union (_dockerContainers old) (_dockerContainers new) } -instance Empty (DockerInfo h) where +instance Empty DockerInfo where isEmpty i = and [ isEmpty (_dockerRunParams i) , isEmpty (_dockerContainers i) -- cgit v1.2.3