summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2017-07-05 16:47:12 -0400
committerJoey Hess2017-07-05 16:47:12 -0400
commit256c5c3c572e56d3755914e40cfd9dfd94112bbb (patch)
treedf7877de2ee647713fb9e94bdb385dba070ae1f9 /src
parent36671f5c992905aa71722b16d800313f60a02622 (diff)
File.isCopyOf: Fix bug that prevented this property from working when the destination file did not yet exist.
This commit was sponsored by andrea rota.
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Property/File.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs
index b1e72989..8d10b94c 100644
--- a/src/Propellor/Property/File.hs
+++ b/src/Propellor/Property/File.hs
@@ -154,7 +154,10 @@ f `isCopyOf` src = property desc $ go =<< (liftIO $ tryIO $ getFileStatus src)
where
desc = f ++ " is copy of " ++ src
go (Right stat) = if isRegularFile stat
- then gocmp =<< (liftIO $ cmp)
+ then ifM (liftIO $ doesFileExist f)
+ ( gocmp =<< (liftIO $ cmp)
+ , doit
+ )
else warningMessage (src ++ " is not a regular file") >>
return FailedChange
go (Left e) = warningMessage (show e) >> return FailedChange