summaryrefslogtreecommitdiff
path: root/src/Propellor/PrivData.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2015-09-30 16:39:38 -0400
committerJoey Hess <joeyh@joeyh.name>2015-09-30 16:39:38 -0400
commitbe5d4b6dbc919f0c390b2c4a78ae8b0e348e4933 (patch)
tree1700b8bb3521d067a9e3406cdff86a9fe2890b94 /src/Propellor/PrivData.hs
parenta1ba3c61249ac0b8b5367b0ed5bc5b1b58974173 (diff)
parentfbc9f293eb4bd545ff4fea9ca87cb97ab74eb4d4 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/PrivData.hs')
-rw-r--r--src/Propellor/PrivData.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Propellor/PrivData.hs b/src/Propellor/PrivData.hs
index 5df9fe0d..0019730d 100644
--- a/src/Propellor/PrivData.hs
+++ b/src/Propellor/PrivData.hs
@@ -17,6 +17,7 @@ module Propellor.PrivData (
decryptPrivData,
PrivMap,
PrivInfo,
+ forceHostContext,
) where
import Control.Applicative
@@ -236,3 +237,10 @@ newtype PrivInfo = PrivInfo
-- hosts need it.
instance IsInfo PrivInfo where
propigateInfo _ = True
+
+-- | Sets the context of any privdata that uses HostContext to the
+-- provided name.
+forceHostContext :: String -> PrivInfo -> PrivInfo
+forceHostContext name i = PrivInfo $ S.map go (fromPrivInfo i)
+ where
+ go (f, d, HostContext ctx) = (f, d, HostContext (const $ ctx name))