propellor spin

This commit is contained in:
Joey Hess 2014-04-14 16:01:17 -04:00
parent 0f3226a298
commit 1f2c68d595
Failed to extract signature
2 changed files with 8 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import Control.Applicative
import Data.List import Data.List
import System.IO import System.IO
import Control.Monad import Control.Monad
import System.Process (env)
import Propellor import Propellor
import qualified Propellor.Property.File as File import qualified Propellor.Property.File as File
@ -195,12 +196,13 @@ reConfigure package vals = reconfigure `requires` setselections
`describe` ("reconfigure " ++ package) `describe` ("reconfigure " ++ package)
where where
setselections = Property "preseed" $ makeChange $ setselections = Property "preseed" $ makeChange $
withHandle StdinHandle createProcessSuccess withHandle StdinHandle createProcessSuccess p $ \h -> do
(proc "debconf-set-selections" []) $ \h -> do forM_ vals $ \(tmpl, tmpltype, value) ->
forM_ vals $ \(tmpl, tmpltype, value) -> hPutStrLn h $ unwords [package, tmpl, tmpltype, value]
hPutStrLn h $ unwords [package, tmpl, tmpltype, value] hClose h
hClose h
reconfigure = cmdProperty "dpkg-reconfigure" ["-fnone", package] reconfigure = cmdProperty "dpkg-reconfigure" ["-fnone", package]
p = (proc "debconf-set-selections" [])
{ env = Just noninteractiveEnv }
-- | Ensures that a service is installed and running. -- | Ensures that a service is installed and running.
-- --

View File

@ -15,7 +15,7 @@ installed = Apt.serviceInstalledRunning "postfix"
satellite :: Property satellite :: Property
satellite = setup `requires` installed satellite = setup `requires` installed
where where
setup = Property "postfix satellite system" $ do setup = trivial $ Property "postfix satellite system" $ do
hn <- getHostName hn <- getHostName
ensureProperty $ Apt.reConfigure "postfix" ensureProperty $ Apt.reConfigure "postfix"
[ ("postfix/main_mailer_type", "select", "Satellite system") [ ("postfix/main_mailer_type", "select", "Satellite system")