summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/File.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@debian.org>2014-07-09 22:11:31 -0400
committerJoey Hess <joeyh@debian.org>2014-07-09 22:11:31 -0400
commitf118c369d3240b656e4fef77b6efc758b3f714eb (patch)
tree0a3e0c6e134680e35665364b2cd6895863bcc990 /src/Propellor/Property/File.hs
parent17b21794a72f6cfaddda321d6f2cbdb87ce3dee0 (diff)
parent82da31b3e0e9acdfbca4c48eb12ab1f28515ba10 (diff)
Record propellor (0.8.1) in archive suite sid
Diffstat (limited to 'src/Propellor/Property/File.hs')
-rw-r--r--src/Propellor/Property/File.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs
index 0b060177..0e738f25 100644
--- a/src/Propellor/Property/File.hs
+++ b/src/Propellor/Property/File.hs
@@ -17,16 +17,17 @@ f `hasContent` newcontent = fileProperty ("replace " ++ f)
--
-- The file's permissions are preserved if the file already existed.
-- Otherwise, they're set to 600.
-hasPrivContent :: FilePath -> Property
-hasPrivContent f = property desc $ withPrivData (PrivFile f) $ \privcontent ->
- ensureProperty $ fileProperty' writeFileProtected desc
- (\_oldcontent -> lines privcontent) f
+hasPrivContent :: FilePath -> Context -> Property
+hasPrivContent f context = withPrivData (PrivFile f) context $ \getcontent ->
+ property desc $ getcontent $ \privcontent ->
+ ensureProperty $ fileProperty' writeFileProtected desc
+ (\_oldcontent -> lines privcontent) f
where
desc = "privcontent " ++ f
-- | Leaves the file world-readable.
-hasPrivContentExposed :: FilePath -> Property
-hasPrivContentExposed f = hasPrivContent f `onChange`
+hasPrivContentExposed :: FilePath -> Context -> Property
+hasPrivContentExposed f context = hasPrivContent f context `onChange`
mode f (combineModes (ownerWriteMode:readModes))
-- | Ensures that a line is present in a file, adding it to the end if not.