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

Safe HaskellNone
LanguageHaskell98

Propellor.Property

Contents

Synopsis

Property combinators

requires :: Combines x y => x -> y -> CombinedType x y Source

Indicates that the first property depends on the second, so before the first is ensured, the second must be ensured.

before :: (IsProp x, Combines y x, IsProp (CombinedType y x)) => x -> y -> CombinedType y x Source

Combines together two properties, resulting in one property that ensures the first, and if the first succeeds, ensures the second.

The combined property uses the description of the first property.

onChange :: Combines (Property x) (Property y) => Property x -> Property y -> CombinedType (Property x) (Property y) Source

Whenever a change has to be made for a Property, causes a hook Property to also be run, but not otherwise.

onChangeFlagOnFail :: Combines (Property x) (Property y) => FilePath -> Property x -> Property y -> CombinedType (Property x) (Property y) Source

Same as onChange except that if property y fails, a flag file is generated. On next run, if the flag file is present, property y is executed even if property x doesn't change.

With onChange, if y fails, the property x onChange y returns FailedChange. But if this property is applied again, it returns NoChange. This behavior can cause trouble...

flagFile :: Property i -> FilePath -> Property i Source

Makes a perhaps non-idempotent Property be idempotent by using a flag file to indicate whether it has run before. Use with caution.

check :: IO Bool -> Property i -> Property i Source

Makes a Property only need to do anything when a test succeeds.

fallback :: Combines (Property p1) (Property p2) => Property p1 -> Property p2 -> Property (CInfo p1 p2) Source

Tries the first property, but if it fails to work, instead uses the second.

trivial :: Property i -> Property i Source

Marks a Property as trivial. It can only return FailedChange or NoChange.

Useful when it's just as expensive to check if a change needs to be made as it is to just idempotently assure the property is satisfied. For example, chmodding a file.

revert :: RevertableProperty -> RevertableProperty Source

Undoes the effect of a RevertableProperty.

Property descriptions

describe :: IsProp p => p -> Desc -> p Source

Changes the description of a property.

(==>) :: IsProp (Property i) => Desc -> Property i -> Property i infixl 1 Source

Alias for flip describe

Constructing properties

data 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.

property :: Desc -> Propellor Result -> Property NoInfo Source

Constructs a Property, from a description and an action to run to ensure the Property is met.

ensureProperty :: Property NoInfo -> Propellor Result Source

For when code running in the Propellor monad needs to ensure a Property.

This can only be used on a Property that has NoInfo.

withOS :: Desc -> (Maybe System -> Propellor Result) -> Property NoInfo Source

Makes a property that is satisfied differently depending on the host's operating system.

Note that the operating system may not be declared for all hosts.

 myproperty = withOS "foo installed" $ \o -> case o of
 	(Just (System (Debian suite) arch)) -> ...
 	(Just (System (Ubuntu release) arch)) -> ...
	Nothing -> ...

endAction :: Desc -> (Result -> Propellor Result) -> Propellor () Source

Registers an action that should be run at the very end, after propellor has checks all the properties of a host.