summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Nginx.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-10-31 17:57:17 -0400
committerJoey Hess <joey@kitenet.net>2014-10-31 17:57:17 -0400
commit85262917891727aedfec998bcd9a68820e818893 (patch)
treec5499983780f9a9cedc315dfd22969da657845a6 /src/Propellor/Property/Nginx.hs
parent218574a4c46049de1e979a4d2aff3a9b31fbd966 (diff)
parentca3dff2566a36245fdede353a445b35aaf5765b4 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Nginx.hs')
-rw-r--r--src/Propellor/Property/Nginx.hs15
1 files changed, 10 insertions, 5 deletions
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