summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Docker.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-30 15:33:14 -0400
committerJoey Hess2015-09-30 15:33:14 -0400
commit84561f6c429a59eaccfc6b957166baf66f7133a1 (patch)
treed5578fcf44df414c9e7c5c3435610fd4ceda0d77 /src/Propellor/Property/Docker.hs
parent47ed1b33c3943852e01a4f376aa85187c07e52b7 (diff)
change HostContext for containers
Privdata that uses HostContext inside a container will now have the name of the container as its context, rather than the name of the host(s) where the container is used. This allows eg, having different passwords for a user in different containers. Note that previously, propellor would prompt using the container name as the context, but not actually use privdata using that context; so this is a bug fix. I don't entirely like the implementation; I had to put the code to change the context in PropAccum, and it's not generalized past PrivInfo.
Diffstat (limited to 'src/Propellor/Property/Docker.hs')
-rw-r--r--src/Propellor/Property/Docker.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index 9cfc24b6..e6365276 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -19,7 +19,7 @@ module Propellor.Property.Docker (
Image(..),
latestImage,
ContainerName,
- Container,
+ Container(..),
HasImage(..),
-- * Container configuration
dns,
@@ -171,7 +171,7 @@ imagePulled ctr = describe pulled msg
image = getImageName ctr
propigateContainerInfo :: (IsProp (Property i)) => Container -> Property i -> Property HasInfo
-propigateContainerInfo ctr@(Container _ h) p = propigateContainer ctr p'
+propigateContainerInfo ctr@(Container _ h) p = propigateContainer cn ctr p'
where
p' = infoProperty
(propertyDesc p)
@@ -179,7 +179,8 @@ propigateContainerInfo ctr@(Container _ h) p = propigateContainer ctr p'
(propertyInfo p <> dockerinfo)
(propertyChildren p)
dockerinfo = dockerInfo $
- mempty { _dockerContainers = M.singleton (hostName h) h }
+ mempty { _dockerContainers = M.singleton cn h }
+ cn = hostName h
mkContainerInfo :: ContainerId -> Container -> ContainerInfo
mkContainerInfo cid@(ContainerId hn _cn) (Container img h) =