From 784210a57398c37d7517ef4636696139c0ec99ea Mon Sep 17 00:00:00 2001 From: Félix Sipma Date: Fri, 31 Oct 2014 20:13:37 +0100 Subject: Propellor.Property.Nginx: use System.Posix.Files Bug: the "onChange reloaded" in siteEnabled does not seem to be fired... Does it works in Propellor.Property.Apache.siteEnabled? Signed-off-by: Félix Sipma --- src/Propellor/Property/Nginx.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Nginx.hs b/src/Propellor/Property/Nginx.hs index 97792fcc..397570d2 100644 --- a/src/Propellor/Property/Nginx.hs +++ b/src/Propellor/Property/Nginx.hs @@ -4,21 +4,26 @@ import Propellor import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Service as Service +import System.Posix.Files type ConfigFile = [String] siteEnabled :: HostName -> ConfigFile -> RevertableProperty siteEnabled hn cf = RevertableProperty enable disable where - enable = trivial (cmdProperty "ln" ["-s", siteValRelativeCfg hn, siteVal hn]) + enable = check test prop `describe` ("nginx site enabled " ++ hn) `requires` siteAvailable hn cf `requires` installed `onChange` reloaded - disable = trivial $ - ("nginx site disabled " ++ hn) ==> - File.notPresent (siteCfg hn) - `onChange` cmdProperty "rm" [siteVal hn] + where + test = not <$> doesFileExist (siteVal hn) + prop = property "nginx site in place" $ makeChange $ + createSymbolicLink target dir + target = siteValRelativeCfg hn + dir = siteVal hn + disable = trivial $ File.notPresent (siteVal hn) + `describe` ("nginx site disable" ++ hn) `requires` installed `onChange` reloaded -- cgit v1.2.3