summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Postfix.hs
diff options
context:
space:
mode:
authorJoey Hess2015-12-05 17:52:43 -0400
committerJoey Hess2015-12-05 17:53:16 -0400
commit12548bae3d8feecce6a322162d91b827289ae824 (patch)
tree45f5ec5131817aab5133c9c1e4dbcf3364953e76 /src/Propellor/Property/Postfix.hs
parentb816e40e2618a8932144bceb7c7039adc5c44c11 (diff)
UncheckedProperty for cmdProperty et al
* Properties that run an arbitrary command, such as cmdProperty and scriptProperty are converted to use UncheckedProperty, since they cannot tell on their own if the command truely made a change or not. (API Change) Transition guide: - When GHC complains about an UncheckedProperty, add: `assume` MadeChange - Since these properties used to always return MadeChange, that change is always safe to make. - Or, if you know that the command should modifiy a file, use: `changesFile` filename * A few properties have had their Result improved, for example Apt.buldDep and Apt.autoRemove now check if a change was made or not.
Diffstat (limited to 'src/Propellor/Property/Postfix.hs')
-rw-r--r--src/Propellor/Property/Postfix.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Propellor/Property/Postfix.hs b/src/Propellor/Property/Postfix.hs
index 356a945f..782e7f45 100644
--- a/src/Propellor/Property/Postfix.hs
+++ b/src/Propellor/Property/Postfix.hs
@@ -55,12 +55,13 @@ mappedFile
-> (FilePath -> Property x)
-> Property (CInfo x NoInfo)
mappedFile f setup = setup f
- `onChange` cmdProperty "postmap" [f]
+ `onChange` (cmdProperty "postmap" [f] `assume` MadeChange)
-- | Run newaliases command, which should be done after changing
-- @/etc/aliases@.
newaliases :: Property NoInfo
-newaliases = trivial $ cmdProperty "newaliases" []
+newaliases = cmdProperty "newaliases" []
+ `assume` MadeChange
-- | The main config file for postfix.
mainCfFile :: FilePath
@@ -74,6 +75,7 @@ mainCf (name, value) = check notset set
setting = name ++ "=" ++ value
notset = (/= Just value) <$> getMainCf name
set = cmdProperty "postconf" ["-e", setting]
+ `assume` MadeChange
-- | Gets a main.cf setting.
getMainCf :: String -> IO (Maybe String)
@@ -159,6 +161,7 @@ saslAuthdInstalled = setupdaemon
dirperm = check (not <$> doesDirectoryExist dir) $
cmdProperty "dpkg-statoverride"
[ "--add", "root", "sasl", "710", dir ]
+ `assume` MadeChange
postfixgroup = (User "postfix") `User.hasGroup` (Group "sasl")
`onChange` restarted
dir = "/var/spool/postfix/var/run/saslauthd"