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

Safe HaskellNone
LanguageHaskell98

Propellor.Property.Cmd

Contents

Synopsis

Properties for running commands and scripts

cmdProperty :: String -> [String] -> Property NoInfo Source

A property that can be satisfied by running a command.

The command must exit 0 on success.

cmdPropertyEnv :: String -> [String] -> [(String, String)] -> Property NoInfo Source

A property that can be satisfied by running a command, with added environment variables in addition to the standard environment.

type Script = [String] Source

A series of shell commands. (Without a leading hashbang.)

scriptProperty :: Script -> Property NoInfo Source

A property that can be satisfied by running a script.

userScriptProperty :: User -> Script -> Property NoInfo Source

A property that can satisfied by running a script as user (cd'd to their home directory).

Lower-level interface for running commands

data CommandParam Source

Parameters that can be passed to a shell command.

Constructors

Param String

A parameter

File FilePath

The name of a file

boolSystem :: FilePath -> [CommandParam] -> IO Bool Source

Run a system command, and returns True or False if it succeeded or failed.

This and other command running functions in this module log the commands run at debug level, using System.Log.Logger.

safeSystem :: FilePath -> [CommandParam] -> IO ExitCode Source

Runs a system command, returning the exit status.

shellEscape :: String -> String Source

Escapes a filename or other parameter to be safely able to be exposed to the shell.

This method works for POSIX shells, as well as other shells like csh.