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

Propellor.Property.Cmd

Description

This module lets you construct Properties by running commands and scripts. To get from an UncheckedProperty to a Property, it's up to the user to check if the command made a change to the system.

The best approach is to check a property, so that the command is only run when it needs to be. With this method, you avoid running the cmdProperty unnecessarily.

check (not <\$> userExists "bob")
(cmdProperty "useradd" ["bob"])

Sometimes it's just as expensive to check a property as it would be to run the command that ensures the property. So you can let the command run every time, and use changesFile or checkResult to determine if anything changed:

cmdProperty "chmod" ["600", "/etc/secret"]
changesFile "/etc/secret"

Or you can punt and assume a change was made, but then propellor will always say it make a change, and onChange will always fire.

cmdProperty "service" ["foo", "reload"]
assume MadeChange

Synopsis

Constricting properties running commands and scripts

A property that can be satisfied by running a command.

The command must exit 0 on success.

cmdPropertyEnv :: String -> [String] -> [(String, String)] -> UncheckedProperty UnixLike 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.)

A property that can be satisfied by running a script.

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

Lower-level interface for running commands

Parameters that can be passed to a shell command.

Constructors

 Param String A parameter File FilePath The name of a file

Instances

 Source # Methods Source # Methods Source # MethodsshowList :: [CommandParam] -> ShowS #

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.

Runs a system command, returning the exit status.

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.

Wrapper around createProcess that does debug logging.

Wrapper around waitForProcess that does debug logging.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.15350045263767242, "perplexity": 5389.525077067133}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-26/segments/1560627998580.10/warc/CC-MAIN-20190617203228-20190617225228-00067.warc.gz"}