propellor-0.8.0: property-based host configuration management in haskell

Safe HaskellNone

Propellor.PrivData

Synopsis

Documentation

withPrivData :: PrivDataField -> Context -> (((PrivData -> Propellor Result) -> Propellor Result) -> Property) -> PropertySource

Allows a Property to access the value of a specific PrivDataField, for use in a specific Context.

Example use:

 withPrivData (PrivFile pemfile) (Context "joeyh.name") $ \getdata ->
     property "joeyh.name ssl cert" $ getdata $ \privdata ->
       liftIO $ writeFile pemfile privdata
   where pemfile = "/etc/ssl/certs/web.pem"

Note that if the value is not available, the action is not run and instead it prints a message to help the user make the necessary private data available.

The resulting Property includes Info about the PrivDataField being used, which is necessary to ensure that the privdata is sent to the remote host by propellor.