From cae7e15f569dfe672b1a667e468447f6153ea5f0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 May 2014 22:00:11 -0400 Subject: split out DockerAttr --- src/Propellor/Property/Docker.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Propellor/Property/Docker.hs') diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index f23738b3..fbf34965 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -72,7 +72,7 @@ type ContainerName = String container :: ContainerName -> Image -> Host container cn image = Host hn [] attr where - attr = mempty { _dockerImage = Val image } + attr = dockerAttr $ mempty { _dockerImage = Val image } hn = cn2hn cn cn2hn :: ContainerName -> HostName @@ -145,7 +145,7 @@ mkContainer cid@(ContainerId hn _cn) h = Container <$> fromVal (_dockerImage attr) <*> pure (map (\a -> a hn) (_dockerRunParams attr)) where - attr = hostAttr h' + attr = _dockerattr $ hostAttr h' h' = h -- expose propellor directory inside the container & volume (localdir++":"++localdir) @@ -443,15 +443,18 @@ listImages :: IO [Image] listImages = lines <$> readProcess dockercmd ["images", "--all", "--quiet"] runProp :: String -> RunParam -> Property -runProp field val = pureAttrProperty (param) $ +runProp field val = pureAttrProperty (param) $ dockerAttr $ mempty { _dockerRunParams = [\_ -> "--"++param] } where param = field++"="++val genProp :: String -> (HostName -> RunParam) -> Property -genProp field mkval = pureAttrProperty field $ +genProp field mkval = pureAttrProperty field $ dockerAttr $ mempty { _dockerRunParams = [\hn -> "--"++field++"=" ++ mkval hn] } +dockerAttr :: DockerAttr -> Attr +dockerAttr a = mempty { _dockerattr = a } + -- | The ContainerIdent of a container is written to -- /.propellor-ident inside it. This can be checked to see if -- the container has the same ident later. -- cgit v1.2.3