From 2410a8f1d6c850142181d724f4abd706a82b9593 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 24 Oct 2015 16:43:26 -0400 Subject: improve RevertableProperty combining * Various property combinators that combined a RevertableProperty with a non-revertable property used to yield a RevertableProperty. This was a bug, because the combined property could not be fully reverted in many cases. Fixed by making the combined property instead be a Property HasInfo. * combineWith now takes an addional parameter to control how revert actions are combined (API change). --- src/Propellor/Property/Concurrent.hs | 10 +++++----- src/Propellor/Property/Dns.hs | 2 +- src/Propellor/Property/DnsSec.hs | 4 ++-- src/Propellor/Property/SiteSpecific/JoeySites.hs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Concurrent.hs b/src/Propellor/Property/Concurrent.hs index 95fd9fc5..c57f5228 100644 --- a/src/Propellor/Property/Concurrent.hs +++ b/src/Propellor/Property/Concurrent.hs @@ -21,11 +21,11 @@ import Control.Monad.RWS.Strict -- | Ensures two properties concurrently. concurrently - :: (IsProp (Property x), IsProp (Property y), Combines (Property x) (Property y), IsProp (Property (CInfo x y))) - => Property x - -> Property y - -> CombinedType (Property x) (Property y) -concurrently p1 p2 = (combineWith go p1 p2) + :: (IsProp p1, IsProp p2, Combines p1 p2, IsProp (CombinedType p1 p2)) + => p1 + -> p2 + -> CombinedType p1 p2 +concurrently p1 p2 = (combineWith go go p1 p2) `describe` d where d = getDesc p1 ++ " `concurrently` " ++ getDesc p2 diff --git a/src/Propellor/Property/Dns.hs b/src/Propellor/Property/Dns.hs index 6646582b..4c2f787f 100644 --- a/src/Propellor/Property/Dns.hs +++ b/src/Propellor/Property/Dns.hs @@ -164,7 +164,7 @@ signedPrimary recurrance hosts domain soa rs = setup cleanup `onChange` Service.reloaded "bind9" cleanup = cleanupPrimary zonefile domain - `onChange` toProp (revert (zoneSigned domain zonefile)) + `onChange` revert (zoneSigned domain zonefile) `onChange` Service.reloaded "bind9" -- Include the public keys into the zone file. diff --git a/src/Propellor/Property/DnsSec.hs b/src/Propellor/Property/DnsSec.hs index 7d1414d4..c0aa1302 100644 --- a/src/Propellor/Property/DnsSec.hs +++ b/src/Propellor/Property/DnsSec.hs @@ -41,11 +41,11 @@ zoneSigned :: Domain -> FilePath -> RevertableProperty zoneSigned domain zonefile = setup cleanup where setup = check needupdate (forceZoneSigned domain zonefile) - `requires` toProp (keysInstalled domain) + `requires` keysInstalled domain cleanup = File.notPresent (signedZoneFile zonefile) `before` File.notPresent dssetfile - `before` toProp (revert (keysInstalled domain)) + `before` revert (keysInstalled domain) dssetfile = dir "-" ++ domain ++ "." dir = takeDirectory zonefile diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index 70d5884f..92903e9a 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -924,7 +924,7 @@ legacyWebSites = propertyList "legacy web sites" $ props userDirHtml :: Property HasInfo userDirHtml = File.fileProperty "apache userdir is html" (map munge) conf `onChange` Apache.reloaded - `requires` (toProp $ Apache.modEnabled "userdir") + `requires` Apache.modEnabled "userdir" where munge = replace "public_html" "html" conf = "/etc/apache2/mods-available/userdir.conf" -- cgit v1.3-2-g0d8e