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 <gueux@gueux.org>
This commit is contained in:
Félix Sipma 2014-10-31 20:13:37 +01:00 committed by Joey Hess
parent 5a6ff0b0f3
commit 784210a573
1 changed files with 10 additions and 5 deletions

View File

@ -4,21 +4,26 @@ import Propellor
import qualified Propellor.Property.File as File import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service import qualified Propellor.Property.Service as Service
import System.Posix.Files
type ConfigFile = [String] type ConfigFile = [String]
siteEnabled :: HostName -> ConfigFile -> RevertableProperty siteEnabled :: HostName -> ConfigFile -> RevertableProperty
siteEnabled hn cf = RevertableProperty enable disable siteEnabled hn cf = RevertableProperty enable disable
where where
enable = trivial (cmdProperty "ln" ["-s", siteValRelativeCfg hn, siteVal hn]) enable = check test prop
`describe` ("nginx site enabled " ++ hn) `describe` ("nginx site enabled " ++ hn)
`requires` siteAvailable hn cf `requires` siteAvailable hn cf
`requires` installed `requires` installed
`onChange` reloaded `onChange` reloaded
disable = trivial $ where
("nginx site disabled " ++ hn) ==> test = not <$> doesFileExist (siteVal hn)
File.notPresent (siteCfg hn) prop = property "nginx site in place" $ makeChange $
`onChange` cmdProperty "rm" [siteVal hn] createSymbolicLink target dir
target = siteValRelativeCfg hn
dir = siteVal hn
disable = trivial $ File.notPresent (siteVal hn)
`describe` ("nginx site disable" ++ hn)
`requires` installed `requires` installed
`onChange` reloaded `onChange` reloaded