Fix bug in File.containsLines that caused lines that were already in the file to sometimes be appended to the end.

This commit is contained in:
Joey Hess 2014-07-17 23:32:29 -04:00
parent c65e9adc7f
commit 55a638ad4c
3 changed files with 10 additions and 5 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
propellor (0.8.2) UNRELEASED; urgency=medium
* Fix bug in File.containsLines that caused lines that were already in the
file to sometimes be appended to the end.
-- Joey Hess <joeyh@debian.org> Thu, 17 Jul 2014 23:32:01 -0400
propellor (0.8.1) unstable; urgency=medium
* Run apt-get update in initial bootstrap.

View File

@ -41,11 +41,9 @@ containsLine :: FilePath -> Line -> Property
f `containsLine` l = f `containsLines` [l]
containsLines :: FilePath -> [Line] -> Property
f `containsLines` l = fileProperty (f ++ " contains:" ++ show l) go f
f `containsLines` ls = fileProperty (f ++ " contains:" ++ show ls) go f
where
go ls
| all (`elem` ls) l = ls
| otherwise = ls++l
go content = content ++ filter (`notElem` content) ls
-- | Ensures that a line is not present in a file.
-- Note that the file is ensured to exist, so if it doesn't, an empty

View File

@ -465,7 +465,7 @@ kiteMailServer = propertyList "kitenet.net mail server"
, "smtp_use_tls = yes"
, "smtp_tls_session_cache_database = sdbm:/etc/postfix/smtp_scache"
]
-- `onChange` Postfix.dedupMainCf
`onChange` Postfix.dedupMainCf
`onChange` Service.restarted "postfix"
`describe` "postfix configured"
, Apt.serviceInstalledRunning "dovecot-imapd"