summaryrefslogtreecommitdiff
path: root/src/Propellor/Container.hs
diff options
context:
space:
mode:
authorJoey Hess2017-03-11 16:52:00 -0400
committerJoey Hess2017-03-11 16:52:00 -0400
commit9a54ba471986b994f10ad332f27639059c18e7e1 (patch)
treef940327c4f66f6e38420a402cd36a7b1ad6bc260 /src/Propellor/Container.hs
parent8a7efe723e4de97065424d1e2396fe0ce5144f56 (diff)
don't propagate DNS info from DiskImage chroots
* DiskImage building properties used to propagate DNS info out from the chroot used to build the disk image to the Host. That is no longer done, since that chroot only exists as a side effect of the disk image creation and servers will not be running in it. * The IsInfo types class's propagateInfo function changed to use a PropagateInfo data type. (API change) This is particularly important when using hostChroot, since the host could well have DNS settings then. This commit was sponsored by Ole-Morten Duesund on Patreon.
Diffstat (limited to 'src/Propellor/Container.hs')
-rw-r--r--src/Propellor/Container.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/Propellor/Container.hs b/src/Propellor/Container.hs
index 26194456..b64f5949 100644
--- a/src/Propellor/Container.hs
+++ b/src/Propellor/Container.hs
@@ -51,15 +51,30 @@ propagateContainer
)
=> String
-> c
+ -> (PropagateInfo -> Bool)
-> Property metatypes
-> Property metatypes
-propagateContainer containername c prop = prop
+propagateContainer containername c wanted prop = prop
`addChildren` map convert (containerProperties c)
where
convert p =
let n = property (getDesc p) (getSatisfy p) :: Property UnixLike
n' = n
`setInfoProperty` mapInfo (forceHostContext containername)
- (propagatableInfo (getInfo p))
+ (propagatableInfo wanted (getInfo p))
`addChildren` map convert (getChildren p)
in toChildProperty n'
+
+-- | Filters out parts of the Info that should not propagate out of a
+-- container.
+propagatableInfo :: (PropagateInfo -> Bool) -> Info -> Info
+propagatableInfo wanted (Info l) = Info $
+ filter (\(InfoEntry a) -> wanted (propagateInfo a)) l
+
+normalContainerInfo :: PropagateInfo -> Bool
+normalContainerInfo PropagatePrivData = True
+normalContainerInfo (PropagateInfo b) = b
+
+onlyPrivData :: PropagateInfo -> Bool
+onlyPrivData PropagatePrivData = True
+onlyPrivData (PropagateInfo _) = False