diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Apache.hs | 11 | ||||
| -rw-r--r-- | src/Propellor/Property/File.hs | 8 |
2 files changed, 11 insertions, 8 deletions
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. |
