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

Safe HaskellNone
LanguageHaskell98

Propellor.Property.File

Synopsis

Documentation

hasContent :: FilePath -> [Line] -> Property NoInfo Source

Replaces all the content of a file.

hasContentProtected :: FilePath -> [Line] -> Property NoInfo Source

Replaces all the content of a file, ensuring that its modes do not allow it to be read or written by anyone other than the current user

hasPrivContent :: IsContext c => FilePath -> c -> Property HasInfo Source

Ensures a file has contents that comes from PrivData.

The file's permissions are preserved if the file already existed. Otherwise, they're set to 600.

hasPrivContentFrom :: (IsContext c, IsPrivDataSource s) => s -> FilePath -> c -> Property HasInfo Source

Like hasPrivContent, but allows specifying a source for PrivData, rather than using PrivDataSourceFile .

hasPrivContentExposed :: IsContext c => FilePath -> c -> Property HasInfo Source

Leaves the file at its default or current mode, allowing "private" data to be read.

Use with caution!

containsLine :: FilePath -> Line -> Property NoInfo Source

Ensures that a line is present in a file, adding it to the end if not.

lacksLine :: FilePath -> Line -> Property NoInfo Source

Ensures that a line is not present in a file. Note that the file is ensured to exist, so if it doesn't, an empty file will be written.

notPresent :: FilePath -> Property NoInfo Source

Removes a file. Does not remove symlinks or non-plain-files.

dirExists :: FilePath -> Property NoInfo Source

Ensures a directory exists.

newtype LinkTarget Source

The location that a symbolic link points to.

Constructors

LinkTarget FilePath 

isSymlinkedTo :: FilePath -> LinkTarget -> Property NoInfo Source

Creates or atomically updates a symbolic link.

Does not overwrite regular files or directories.

ownerGroup :: FilePath -> User -> Group -> Property NoInfo Source

Ensures that a file/dir has the specified owner and group.

mode :: FilePath -> FileMode -> Property NoInfo Source

Ensures that a file/dir has the specfied mode.

stableTmpFor :: FilePath -> FilePath Source

A temp file to use when writing new content for a file.

This is a stable name so it can be removed idempotently.

It ends with "~" so that programs that read many config files from a directory will treat it as an editor backup file, and not read it.

viaStableTmp :: (MonadMask m, MonadIO m) => (FilePath -> m ()) -> FilePath -> m () Source

Creates/updates a file atomically, running the action to create the stable tmp file, and then renaming it into place.