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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Propellor.Types.Core

Synopsis

- data Host = Host {
  - hostName :: HostName
  - hostProperties :: [ChildProperty]
  - hostInfo :: Info
  }
- newtype Propellor p = Propellor {
  - runWithHost :: RWST Host [EndAction] () IO p
  }
- class LiftPropellor m where
  - liftPropellor :: m a -> Propellor a
- data EndAction = EndAction Desc (Result -> Propellor Result)
- type Desc = String
- data Props metatypes = Props [ChildProperty]
- data ChildProperty = ChildProperty Desc (Maybe (Propellor Result)) Info [ChildProperty]
- class IsProp p where
  - setDesc :: p -> Desc -> p
  - getDesc :: p -> Desc
  - getChildren :: p -> [ChildProperty]
  - addChildren :: p -> [ChildProperty] -> p
  - getInfoRecursive :: p -> Info
  - getInfo :: p -> Info
  - toChildProperty :: p -> ChildProperty
  - getSatisfy :: p -> Maybe (Propellor Result)
- propsInfo :: Props metatypes -> Info

# Documentation

data Host Source #

Everything Propellor knows about a system: Its hostname, properties and their collected info.

Constructors

Host |

Fields

- hostName :: HostName
- hostProperties :: [ChildProperty]
- hostInfo :: Info

#### Instances

Instances details

Show Host Source # |
Instance details Defined in Propellor.Types.Core Methods showsPrec :: Int -> Host -> ShowS show :: Host -> String showList :: [Host] -> ShowS
IsContainer Host Source # |
Instance details Defined in Propellor.Container Methods containerProperties :: Host -> [ChildProperty] Source # containerInfo :: Host -> Info Source # setContainerProperties :: Host -> [ChildProperty] -> Host Source #
Conductable Host Source # |
Instance details Defined in Propellor.Property.Conductor Methods conducts :: Host -> RevertableProperty (HasInfo + UnixLike) (HasInfo + UnixLike) Source #
MonadReader Host Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods ask :: Propellor Host local :: (Host -> Host) -> Propellor a -> Propellor a reader :: (Host -> a) -> Propellor a
Conductable [Host] Source # |
Instance details Defined in Propellor.Property.Conductor Methods conducts :: [Host] -> RevertableProperty (HasInfo + UnixLike) (HasInfo + UnixLike) Source #

newtype Propellor p Source #

Propellor's monad provides read-only access to info about the host it's running on, and a writer to accumulate EndActions.

Constructors

Propellor |

Fields

- runWithHost :: RWST Host [EndAction] () IO p

#### Instances

Instances details

MonadIO Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods liftIO :: IO a -> Propellor a
Applicative Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods pure :: a -> Propellor a (<*>) :: Propellor (a -> b) -> Propellor a -> Propellor b liftA2 :: (a -> b -> c) -> Propellor a -> Propellor b -> Propellor c (*>) :: Propellor a -> Propellor b -> Propellor b (<*) :: Propellor a -> Propellor b -> Propellor a
Functor Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods fmap :: (a -> b) -> Propellor a -> Propellor b (<$) :: a -> Propellor b -> Propellor a
Monad Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods (>>=) :: Propellor a -> (a -> Propellor b) -> Propellor b (>>) :: Propellor a -> Propellor b -> Propellor b return :: a -> Propellor a
MonadCatch Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods catch :: (HasCallStack, Exception e) => Propellor a -> (e -> Propellor a) -> Propellor a #
MonadMask Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods mask :: HasCallStack => ((forall a. Propellor a -> Propellor a) -> Propellor b) -> Propellor b # uninterruptibleMask :: HasCallStack => ((forall a. Propellor a -> Propellor a) -> Propellor b) -> Propellor b # generalBracket :: HasCallStack => Propellor a -> (a -> ExitCase b -> Propellor c) -> (a -> Propellor b) -> Propellor (b, c) #
MonadThrow Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods throwM :: (HasCallStack, Exception e) => e -> Propellor a #
LiftPropellor Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods liftPropellor :: Propellor a -> Propellor a Source #
MonadReader Host Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods ask :: Propellor Host local :: (Host -> Host) -> Propellor a -> Propellor a reader :: (Host -> a) -> Propellor a
Monoid (Propellor Result) Source # |
Instance details Defined in Propellor.Types.Core Methods mempty :: Propellor Result # mappend :: Propellor Result -> Propellor Result -> Propellor Result # mconcat :: [Propellor Result] -> Propellor Result #
Semigroup (Propellor Result) Source # | When two actions are appended together, the second action is only run if the first action does not fail.
Instance details Defined in Propellor.Types.Core Methods (<>) :: Propellor Result -> Propellor Result -> Propellor Result # sconcat :: NonEmpty (Propellor Result) -> Propellor Result stimes :: Integral b => b -> Propellor Result -> Propellor Result
MonadWriter [EndAction] Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods writer :: (a, [EndAction]) -> Propellor a tell :: [EndAction] -> Propellor () listen :: Propellor a -> Propellor (a, [EndAction]) pass :: Propellor (a, [EndAction] -> [EndAction]) -> Propellor a

class LiftPropellor m where Source #

Methods

liftPropellor :: m a -> Propellor a Source #

#### Instances

Instances details

LiftPropellor IO Source # |
Instance details Defined in Propellor.Types.Core Methods liftPropellor :: IO a -> Propellor a Source #
LiftPropellor Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods liftPropellor :: Propellor a -> Propellor a Source #

data EndAction Source #

An action that Propellor runs at the end, after trying to satisfy all properties. It's passed the combined Result of the entire Propellor run.

Constructors

EndAction Desc (Result -> Propellor Result) |

#### Instances

Instances details

MonadWriter [EndAction] Propellor Source # |
Instance details Defined in Propellor.Types.Core Methods writer :: (a, [EndAction]) -> Propellor a tell :: [EndAction] -> Propellor () listen :: Propellor a -> Propellor (a, [EndAction]) pass :: Propellor (a, [EndAction] -> [EndAction]) -> Propellor a

type Desc = String Source #

data Props metatypes Source #

Props is a combination of a list of properties, with their combined metatypes.

Constructors

Props [ChildProperty] |

data ChildProperty Source #

Since there are many different types of Properties, they cannot be put into a list. The simplified ChildProperty can be put into a list.

Constructors

ChildProperty Desc (Maybe (Propellor Result)) Info [ChildProperty] |

#### Instances

Instances details

Show ChildProperty Source # |
Instance details Defined in Propellor.Types.Core Methods showsPrec :: Int -> ChildProperty -> ShowS show :: ChildProperty -> String showList :: [ChildProperty] -> ShowS
IsProp ChildProperty Source # |

Instance details

Defined in Propellor.Types.Core

Methods

setDesc :: ChildProperty -> Desc -> ChildProperty Source #

getDesc :: ChildProperty -> Desc Source #

getChildren :: ChildProperty -> [ChildProperty] Source #

addChildren :: ChildProperty -> [ChildProperty] -> ChildProperty Source #

getInfoRecursive :: ChildProperty -> Info Source #

getInfo :: ChildProperty -> Info Source #

toChildProperty :: ChildProperty -> ChildProperty Source #

getSatisfy :: ChildProperty -> Maybe (Propellor Result) Source #

class IsProp p where Source #

Methods

setDesc :: p -> Desc -> p Source #

getDesc :: p -> Desc Source #

getChildren :: p -> [ChildProperty] Source #

addChildren :: p -> [ChildProperty] -> p Source #

getInfoRecursive :: p -> Info Source #

Gets the info of the property, combined with all info of all children properties.

getInfo :: p -> Info Source #

Info, not including info from children.

toChildProperty :: p -> ChildProperty Source #

Gets a ChildProperty representing the Property. You should not normally need to use this.

getSatisfy :: p -> Maybe (Propellor Result) Source #

Gets the action that can be run to satisfy a Property. You should never run this action directly. Use `ensureProperty` instead.

#### Instances

Instances details

IsProp ChildProperty Source # |

Instance details

Defined in Propellor.Types.Core

Methods

setDesc :: ChildProperty -> Desc -> ChildProperty Source #

getDesc :: ChildProperty -> Desc Source #

getChildren :: ChildProperty -> [ChildProperty] Source #

addChildren :: ChildProperty -> [ChildProperty] -> ChildProperty Source #

getInfoRecursive :: ChildProperty -> Info Source #

getInfo :: ChildProperty -> Info Source #

toChildProperty :: ChildProperty -> ChildProperty Source #

getSatisfy :: ChildProperty -> Maybe (Propellor Result) Source #

IsProp (Property metatypes) Source # |

Instance details

Defined in Propellor.Types

Methods

setDesc :: Property metatypes -> Desc -> Property metatypes Source #

getDesc :: Property metatypes -> Desc Source #

getChildren :: Property metatypes -> [ChildProperty] Source #

addChildren :: Property metatypes -> [ChildProperty] -> Property metatypes Source #

getInfoRecursive :: Property metatypes -> Info Source #

getInfo :: Property metatypes -> Info Source #

toChildProperty :: Property metatypes -> ChildProperty Source #

getSatisfy :: Property metatypes -> Maybe (Propellor Result) Source #

IsProp (RevertableProperty setupmetatypes undometatypes) Source # |

Instance details

Defined in Propellor.Types

Methods

setDesc :: RevertableProperty setupmetatypes undometatypes -> Desc -> RevertableProperty setupmetatypes undometatypes Source #

getDesc :: RevertableProperty setupmetatypes undometatypes -> Desc Source #

getChildren :: RevertableProperty setupmetatypes undometatypes -> [ChildProperty] Source #

addChildren :: RevertableProperty setupmetatypes undometatypes -> [ChildProperty] -> RevertableProperty setupmetatypes undometatypes Source #

getInfoRecursive :: RevertableProperty setupmetatypes undometatypes -> Info Source #

getInfo :: RevertableProperty setupmetatypes undometatypes -> Info Source #

toChildProperty :: RevertableProperty setupmetatypes undometatypes -> ChildProperty Source #

getSatisfy :: RevertableProperty setupmetatypes undometatypes -> Maybe (Propellor Result) Source #

propsInfo :: Props metatypes -> Info Source #