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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Propellor.PrivData

Synopsis

- withPrivData :: (IsContext c, IsPrivDataSource s, IncludesInfo metatypes ~ 'True) => s -> c -> (((PrivData -> Propellor Result) -> Propellor Result) -> Property metatypes) -> Property metatypes
- withSomePrivData :: (IsContext c, IsPrivDataSource s, IncludesInfo metatypes ~ 'True) => [s] -> c -> ((((PrivDataField, PrivData) -> Propellor Result) -> Propellor Result) -> Property metatypes) -> Property metatypes
- addPrivData :: (PrivDataField, Maybe PrivDataSourceDesc, HostContext) -> Property (HasInfo + UnixLike)
- setPrivData :: PrivDataField -> Context -> IO ()
- unsetPrivData :: PrivDataField -> Context -> IO ()
- unsetPrivDataUnused :: [Host] -> IO ()
- dumpPrivData :: PrivDataField -> Context -> IO ()
- editPrivData :: PrivDataField -> Context -> IO ()
- filterPrivData :: Host -> PrivMap -> PrivMap
- listPrivDataFields :: [Host] -> IO ()
- makePrivDataDir :: IO ()
- decryptPrivData :: IO PrivMap
- readPrivData :: String -> PrivMap
- readPrivDataFile :: FilePath -> IO PrivMap
- type PrivMap = Map (PrivDataField, Context) String
- data PrivInfo
- forceHostContext :: String -> PrivInfo -> PrivInfo

# Documentation

withPrivData :: (IsContext c, IsPrivDataSource s, IncludesInfo metatypes ~ 'True) => s -> c -> (((PrivData -> Propellor Result) -> Propellor Result) -> Property metatypes) -> Property metatypes Source #

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

Example use:

    withPrivData (PrivFile pemfile) (Context "joeyh.name") $ \getdata ->
        property "joeyh.name ssl cert" $ getdata $ \privdata ->
          liftIO $ writeFile pemfile (privDataVal 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.

withSomePrivData :: (IsContext c, IsPrivDataSource s, IncludesInfo metatypes ~ 'True) => [s] -> c -> ((((PrivDataField, PrivData) -> Propellor Result) -> Propellor Result) -> Property metatypes) -> Property metatypes Source #

addPrivData :: (PrivDataField, Maybe PrivDataSourceDesc, HostContext) -> Property (HasInfo + UnixLike) Source #

setPrivData :: PrivDataField -> Context -> IO () Source #

unsetPrivData :: PrivDataField -> Context -> IO () Source #

unsetPrivDataUnused :: [Host] -> IO () Source #

dumpPrivData :: PrivDataField -> Context -> IO () Source #

editPrivData :: PrivDataField -> Context -> IO () Source #

filterPrivData :: Host -> PrivMap -> PrivMap Source #

Get only the set of PrivData that the Host's Info says it uses.

listPrivDataFields :: [Host] -> IO () Source #

makePrivDataDir :: IO () Source #

decryptPrivData :: IO PrivMap Source #

readPrivData :: String -> PrivMap Source #

readPrivDataFile :: FilePath -> IO PrivMap Source #

type PrivMap = Map (PrivDataField, Context) String Source #

data PrivInfo Source #

#### Instances

Instances details

Monoid PrivInfo Source # |
Instance details Defined in Propellor.PrivData Methods mempty :: PrivInfo # mappend :: PrivInfo -> PrivInfo -> PrivInfo # mconcat :: [PrivInfo] -> PrivInfo #
Semigroup PrivInfo Source # |
Instance details Defined in Propellor.PrivData Methods (<>) :: PrivInfo -> PrivInfo -> PrivInfo # sconcat :: NonEmpty PrivInfo -> PrivInfo stimes :: Integral b => b -> PrivInfo -> PrivInfo
Show PrivInfo Source # |
Instance details Defined in Propellor.PrivData Methods showsPrec :: Int -> PrivInfo -> ShowS show :: PrivInfo -> String showList :: [PrivInfo] -> ShowS
Eq PrivInfo Source # |
Instance details Defined in Propellor.PrivData Methods (==) :: PrivInfo -> PrivInfo -> Bool (/=) :: PrivInfo -> PrivInfo -> Bool
Ord PrivInfo Source # |
Instance details Defined in Propellor.PrivData Methods compare :: PrivInfo -> PrivInfo -> Ordering (<) :: PrivInfo -> PrivInfo -> Bool (<=) :: PrivInfo -> PrivInfo -> Bool (>) :: PrivInfo -> PrivInfo -> Bool (>=) :: PrivInfo -> PrivInfo -> Bool max :: PrivInfo -> PrivInfo -> PrivInfo min :: PrivInfo -> PrivInfo -> PrivInfo
IsInfo PrivInfo Source # |
Instance details Defined in Propellor.PrivData Methods propagateInfo :: PrivInfo -> PropagateInfo Source #

forceHostContext :: String -> PrivInfo -> PrivInfo Source #

Sets the context of any privdata that uses HostContext to the provided name.