summaryrefslogtreecommitdiff
path: root/Propellor/Property/File.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-08 16:58:11 -0400
committerJoey Hess2014-04-08 16:58:11 -0400
commit0460a04474d2ea4f439708bb9f8ded24fba329ac (patch)
treea0e8e90937f2139d0829c540aeadf99ca47526c7 /Propellor/Property/File.hs
parent2e6f7c1b5d04db4841cb748150f2a99dcfba5617 (diff)
propellor spin
Diffstat (limited to 'Propellor/Property/File.hs')
-rw-r--r--Propellor/Property/File.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs
index 80c69d9b..0c1155fe 100644
--- a/Propellor/Property/File.hs
+++ b/Propellor/Property/File.hs
@@ -11,6 +11,13 @@ hasContent :: FilePath -> [Line] -> Property
f `hasContent` newcontent = fileProperty ("replace " ++ f)
(\_oldcontent -> newcontent) f
+-- | Ensures a file has contents that comes from PrivData.
+-- Note: Does not do anything with the permissions of the file to prevent
+-- it from being seen.
+hasPrivContent :: FilePath -> Property
+hasPrivContent f = Property ("privcontent " ++ f) $
+ withPrivData (PrivFile f) (\v -> ensureProperty $ f `hasContent` lines v)
+
-- | Ensures that a line is present in a file, adding it to the end if not.
containsLine :: FilePath -> Line -> Property
f `containsLine` l = fileProperty (f ++ " contains:" ++ l) go f