diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-12-06 14:33:22 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-12-06 14:33:22 -0400 |
| commit | 6c7ad5b021ae46be1fda3004f9c578ab2471d9aa (patch) | |
| tree | 4319434104db22cc4598746eeb2d6fbf244ed7be /src/Propellor/Property/Postfix.hs | |
| parent | 616c6c2e2c2c7dcafa9bc72c7c1bdea650e43e43 (diff) | |
| parent | 516b7cb886470c6a86d4022d7cf20a8547a98bd9 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Postfix.hs')
| -rw-r--r-- | src/Propellor/Property/Postfix.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Propellor/Property/Postfix.hs b/src/Propellor/Property/Postfix.hs index bc46ac21..1c8684c7 100644 --- a/src/Propellor/Property/Postfix.hs +++ b/src/Propellor/Property/Postfix.hs @@ -60,8 +60,8 @@ mappedFile f setup = setup f -- | Run newaliases command, which should be done after changing -- @/etc/aliases@. newaliases :: Property NoInfo -newaliases = cmdProperty "newaliases" [] - `assume` MadeChange +newaliases = check ("/etc/aliases" `isNewerThan` "/etc/aliases.db") + (cmdProperty "newaliases" []) -- | The main config file for postfix. mainCfFile :: FilePath @@ -75,7 +75,6 @@ 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) @@ -161,7 +160,6 @@ 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" @@ -170,15 +168,17 @@ saslAuthdInstalled = setupdaemon -- -- The password is taken from the privdata. saslPasswdSet :: Domain -> User -> Property HasInfo -saslPasswdSet domain (User user) = withPrivData src ctx $ \getpw -> trivial $ - property ("sasl password for " ++ uatd) $ getpw $ \pw -> makeChange $ - withHandle StdinHandle createProcessSuccess p $ \h -> do - hPutStrLn h (privDataVal pw) - hClose h +saslPasswdSet domain (User user) = go `changesFileContent` "/etc/sasldb2" where + go = withPrivData src ctx $ \getpw -> + property desc $ getpw $ \pw -> liftIO $ + withHandle StdinHandle createProcessSuccess p $ \h -> do + hPutStrLn h (privDataVal pw) + hClose h + return NoChange + desc = "sasl password for " ++ uatd uatd = user ++ "@" ++ domain ps = ["-p", "-c", "-u", domain, user] p = proc "saslpasswd2" ps ctx = Context "sasl" src = PrivDataSource (Password uatd) "enter password" - trivial = flip assume NoChange |
