summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config-joey.hs14
-rw-r--r--debian/changelog2
-rw-r--r--src/Propellor/Property/Apache.hs11
-rw-r--r--src/Propellor/Property/File.hs8
4 files changed, 27 insertions, 8 deletions
diff --git a/config-joey.hs b/config-joey.hs
index 9e0cf90f..78954805 100644
--- a/config-joey.hs
+++ b/config-joey.hs
@@ -76,6 +76,20 @@ darkstar = host "darkstar.kitenet.net"
& Apt.buildDep ["git-annex"] `period` Daily
& Docker.configured
! Docker.docked gitAnnexAndroidDev
+ & website "foo"
+
+website :: String -> RevertableProperty
+website hn = Apache.siteEnabled hn apachecfg
+ where
+ apachecfg = [ "<VirtualHost *>"
+ , "DocumentRoot /tmp/xx"
+ , "<Directory /tmp/xx>"
+ , " Options Indexes FollowSymLinks Multiviews"
+ , " Order allow,deny"
+ , Apache.allowAll
+ , "</Directory>"
+ , "</VirtualHost>"
+ ]
clam :: Host
clam = standardSystem "clam.kitenet.net" Unstable "amd64"
diff --git a/debian/changelog b/debian/changelog
index 68564473..c28989d5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ propellor (1.2.0) unstable; urgency=medium
* Removed boolProperty; instead the new toResult can be used. (API change)
* Include Propellor.Property.OS, which was accidentially left out of the
cabal file in the last release.
+ * Fix Apache.siteEnabled to update the config file and reload apache when
+ configuration has changed.
-- Joey Hess <id@joeyh.name> Tue, 09 Dec 2014 00:05:09 -0400
diff --git a/src/Propellor/Property/Apache.hs b/src/Propellor/Property/Apache.hs
index 1d9c35ce..1ce187d8 100644
--- a/src/Propellor/Property/Apache.hs
+++ b/src/Propellor/Property/Apache.hs
@@ -11,12 +11,15 @@ type ConfigFile = [String]
siteEnabled :: HostName -> ConfigFile -> RevertableProperty
siteEnabled hn cf = RevertableProperty enable disable
where
- enable = check (not <$> isenabled) $
- cmdProperty "a2ensite" ["--quiet", hn]
- `describe` ("apache site enabled " ++ hn)
- `requires` siteAvailable hn cf
+ enable = combineProperties ("apache site enabled " ++ hn)
+ [ siteAvailable hn cf
`requires` installed
`onChange` reloaded
+ , check (not <$> isenabled) $
+ cmdProperty "a2ensite" ["--quiet", hn]
+ `requires` installed
+ `onChange` reloaded
+ ]
disable = combineProperties
("apache site disabled " ++ hn)
(map File.notPresent (siteCfg hn))
diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs
index d2296354..a1a86763 100644
--- a/src/Propellor/Property/File.hs
+++ b/src/Propellor/Property/File.hs
@@ -62,11 +62,11 @@ fileProperty' :: (FilePath -> String -> IO ()) -> Desc -> ([Line] -> [Line]) ->
fileProperty' writer desc a f = property desc $ go =<< liftIO (doesFileExist f)
where
go True = do
- ls <- liftIO $ lines <$> readFile f
- let ls' = a ls
- if ls' == ls
+ old <- liftIO $ readFile f
+ let new = unlines (a (lines old))
+ if old == new
then noChange
- else makeChange $ viaTmp updatefile f (unlines ls')
+ else makeChange $ viaTmp updatefile f new
go False = makeChange $ writer f (unlines $ a [])
-- viaTmp makes the temp file mode 600.