Safe Haskell | None |
---|---|
Language | Haskell98 |
- data Host = Host {
- hostName :: HostName
- hostProperties :: [ChildProperty]
- hostInfo :: Info
- data Property metatypes = Property metatypes Desc (Maybe (Propellor Result)) Info [ChildProperty]
- property :: SingI metatypes => Desc -> Propellor Result -> Property (MetaTypes metatypes)
- property'' :: SingI metatypes => Desc -> Maybe (Propellor Result) -> Property (MetaTypes metatypes)
- type Desc = String
- data RevertableProperty setupmetatypes undometatypes = RevertableProperty {
- setupRevertableProperty :: Property setupmetatypes
- undoRevertableProperty :: Property undometatypes
- (<!>) :: Property setupmetatypes -> Property undometatypes -> RevertableProperty setupmetatypes undometatypes
- newtype Propellor p = Propellor {
- runWithHost :: RWST Host [EndAction] () IO p
- class LiftPropellor m where
- data Info
- type UnixLike = MetaTypes '[Targeting OSDebian, Targeting OSBuntish, Targeting OSArchLinux, Targeting OSFreeBSD]
- type Linux = MetaTypes '[Targeting OSDebian, Targeting OSBuntish, Targeting OSArchLinux]
- type DebianLike = MetaTypes '[Targeting OSDebian, Targeting OSBuntish]
- type Debian = MetaTypes '[Targeting OSDebian]
- type Buntish = MetaTypes '[Targeting OSBuntish]
- type ArchLinux = MetaTypes '[Targeting OSArchLinux]
- type FreeBSD = MetaTypes '[Targeting OSFreeBSD]
- type HasInfo = MetaTypes '[WithInfo]
- type family a + b :: ab
- class TightenTargets p where
- class Combines x y where
- type family CombinedType x y
- type ResultCombiner = Maybe (Propellor Result) -> Maybe (Propellor Result) -> Maybe (Propellor Result)
- adjustPropertySatisfy :: Property metatypes -> (Propellor Result -> Propellor Result) -> Property metatypes
- module Propellor.Types.OS
- module Propellor.Types.ConfigurableValue
- module Propellor.Types.Dns
- module Propellor.Types.Result
- module Propellor.Types.ZFS
Core data types
Everything Propellor knows about a system: Its hostname, properties and their collected info.
Host | |
|
data Property metatypes Source #
The core data type of Propellor, this represents a property that the system should have, with a descrition, and an action to ensure it has the property.
There are different types of properties that target different OS's, and so have different metatypes. For example: "Property DebianLike" and "Property FreeBSD".
Also, some properties have associated Info
, which is indicated in
their type: "Property (HasInfo + DebianLike)"
There are many associated type families, which are mostly used internally, so you needn't worry about them.
property :: SingI metatypes => Desc -> Propellor Result -> Property (MetaTypes metatypes) Source #
Constructs a Property, from a description and an action to run to ensure the Property is met.
Due to the polymorphic return type of this function, most uses will need to specify a type signature. This lets you specify what OS the property targets, etc.
For example:
foo :: Property Debian foo = property "foo" $ do ... return MadeChange
property'' :: SingI metatypes => Desc -> Maybe (Propellor Result) -> Property (MetaTypes metatypes) Source #
data RevertableProperty setupmetatypes undometatypes Source #
A property that can be reverted. The first Property is run normally and the second is run when it's reverted.
See Versioned
for a way to use RevertableProperty to define different
versions of a host.
RevertableProperty | |
|
((~) CheckCombine (CheckCombinable a x y) CanCombine, SingI [a] (Combine a x y)) => Combines (Property (MetaTypes [a] x)) (RevertableProperty (MetaTypes [a] y) (MetaTypes k y')) Source # | |
Show (RevertableProperty setupmetatypes undometatypes) Source # | |
(Monoid (Property setupmetatypes), Monoid (Property undometatypes)) => Monoid (RevertableProperty setupmetatypes undometatypes) Source # | Any type of RevertableProperty is a monoid. When revertable properties x and y are appended together, the resulting revertable property has a description like "x and y". Note that when x fails to be ensured, it will not try to ensure y. |
IsProp (RevertableProperty setupmetatypes undometatypes) Source # | |
((~) CheckCombine (CheckCombinable a x y) CanCombine, SingI [a] (Combine a x y)) => Combines (RevertableProperty (MetaTypes [a] x) (MetaTypes k x')) (Property (MetaTypes [a] y)) Source # | |
((~) CheckCombine (CheckCombinable a1 x y) CanCombine, (~) CheckCombine (CheckCombinable a x' y') CanCombine, SingI [a1] (Combine a1 x y), SingI [a] (Combine a x' y')) => Combines (RevertableProperty (MetaTypes [a1] x) (MetaTypes [a] x')) (RevertableProperty (MetaTypes [a1] y) (MetaTypes [a] y')) Source # | |
type CombinedType (Property (MetaTypes [a] x)) (RevertableProperty (MetaTypes [a] y) (MetaTypes k y')) Source # | |
type CombinedType (RevertableProperty (MetaTypes [a] x) (MetaTypes k x')) (Property (MetaTypes [a] y)) Source # | |
type CombinedType (RevertableProperty (MetaTypes [a1] x) (MetaTypes [a] x')) (RevertableProperty (MetaTypes [a1] y) (MetaTypes [a] y')) Source # | |
(<!>) :: Property setupmetatypes -> Property undometatypes -> RevertableProperty setupmetatypes undometatypes Source #
Shorthand to construct a revertable property from any two Properties.
Propellor's monad provides read-only access to info about the host it's running on, and a writer to accumulate EndActions.
Monad Propellor Source # | |
Functor Propellor Source # | |
Applicative Propellor Source # | |
MonadIO Propellor Source # | |
MonadThrow Propellor Source # | |
MonadCatch Propellor Source # | |
MonadMask Propellor Source # | |
LiftPropellor Propellor Source # | |
MonadReader Host Propellor Source # | |
Monoid (Propellor Result) Source # | When two actions are appended together, the second action is only run if the first action does not fail. |
MonadWriter [EndAction] Propellor Source # | |
class LiftPropellor m where Source #
liftPropellor :: m a -> Propellor a Source #
Types of properties
type UnixLike = MetaTypes '[Targeting OSDebian, Targeting OSBuntish, Targeting OSArchLinux, Targeting OSFreeBSD] Source #
Any unix-like system
type Linux = MetaTypes '[Targeting OSDebian, Targeting OSBuntish, Targeting OSArchLinux] Source #
Any linux system
type DebianLike = MetaTypes '[Targeting OSDebian, Targeting OSBuntish] Source #
Debian and derivatives.
type HasInfo = MetaTypes '[WithInfo] Source #
Used to indicate that a Property adds Info to the Host where it's used.
type family a + b :: ab Source #
Convenience type operator to combine two MetaTypes
lists.
For example:
HasInfo + Debian
Which is shorthand for this type:
MetaTypes '[WithInfo, Targeting OSDebian]
class TightenTargets p where Source #
tightenTargets :: ((Targets untightened `NotSuperset` Targets tightened) ~ CanCombine, (NonTargets tightened `NotSuperset` NonTargets untightened) ~ CanCombine, SingI tightened) => p (MetaTypes untightened) -> p (MetaTypes tightened) Source #
Tightens the MetaType list of a Property (or similar), to contain fewer targets.
For example, to make a property that uses apt-get, which is only available on DebianLike systems:
upgraded :: Property DebianLike upgraded = tightenTargets $ cmdProperty "apt-get" ["upgrade"]
Combining and modifying properties
class Combines x y where Source #
combineWith :: ResultCombiner -> ResultCombiner -> x -> y -> CombinedType x y Source #
Combines together two properties, yielding a property that has the description and info of the first, and that has the second property as a child property.
((~) CheckCombine (CheckCombinable a x y) CanCombine, SingI [a] (Combine a x y)) => Combines (Property (MetaTypes [a] x)) (Property (MetaTypes [a] y)) Source # | |
((~) CheckCombine (CheckCombinable a x y) CanCombine, SingI [a] (Combine a x y)) => Combines (Property (MetaTypes [a] x)) (RevertableProperty (MetaTypes [a] y) (MetaTypes k y')) Source # | |
((~) CheckCombine (CheckCombinable a x y) CanCombine, SingI [a] (Combine a x y)) => Combines (RevertableProperty (MetaTypes [a] x) (MetaTypes k x')) (Property (MetaTypes [a] y)) Source # | |
((~) CheckCombine (CheckCombinable a1 x y) CanCombine, (~) CheckCombine (CheckCombinable a x' y') CanCombine, SingI [a1] (Combine a1 x y), SingI [a] (Combine a x' y')) => Combines (RevertableProperty (MetaTypes [a1] x) (MetaTypes [a] x')) (RevertableProperty (MetaTypes [a1] y) (MetaTypes [a] y')) Source # | |
type family CombinedType x y Source #
Type level calculation of the type that results from combining two types of properties.
type CombinedType (Property (MetaTypes [a] x)) (Property (MetaTypes [a] y)) Source # | |
type CombinedType (Property (MetaTypes [a] x)) (RevertableProperty (MetaTypes [a] y) (MetaTypes k y')) Source # | |
type CombinedType (RevertableProperty (MetaTypes [a] x) (MetaTypes k x')) (Property (MetaTypes [a] y)) Source # | |
type CombinedType (RevertableProperty (MetaTypes [a1] x) (MetaTypes [a] x')) (RevertableProperty (MetaTypes [a1] y) (MetaTypes [a] y')) Source # | |
type ResultCombiner = Maybe (Propellor Result) -> Maybe (Propellor Result) -> Maybe (Propellor Result) Source #
adjustPropertySatisfy :: Property metatypes -> (Propellor Result -> Propellor Result) -> Property metatypes Source #
Changes the action that is performed to satisfy a property.
Other included types
module Propellor.Types.OS
module Propellor.Types.Dns
module Propellor.Types.Result
module Propellor.Types.ZFS