summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2013-03-04 23:37:57 +0100
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2013-03-04 23:37:57 +0100
commita1510a1e71cafd7c6d20d407e77b1e1fc165475d (patch)
tree3686d6336c4ed09634fb0c6d69592075225a7027
parent9a06f11b11c96fff20a2e62c69a29684d943b773 (diff)
downloadpuppet-stdlib-a1510a1e71cafd7c6d20d407e77b1e1fc165475d.tar.gz
puppet-stdlib-a1510a1e71cafd7c6d20d407e77b1e1fc165475d.tar.bz2
Add missing documentation for validate_augeas and validate_cmd to README.markdown
-rw-r--r--README.markdown55
1 files changed, 55 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index c58d31f..f1ac6b3 100644
--- a/README.markdown
+++ b/README.markdown
@@ -779,6 +779,38 @@ The following values will fail, causing compilation to abort:
- *Type*: statement
+validate_augeas
+--------------
+Perform validation of a string using an Augeas lens
+The first argument of this function should be a string to
+test, and the second argument should be the name of the Augeas lens to use.
+If Augeas fails to parse the string with the lens, the compilation will
+abort with a parse error.
+
+A third argument can be specified, listing paths which should
+not be found in the file. The `$file` variable points to the location
+of the temporary file being tested in the Augeas tree.
+
+For example, if you want to make sure your passwd content never contains
+a user `foo`, you could write:
+
+ validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo'])
+
+Or if you wanted to ensure that no users used the '/bin/barsh' shell,
+you could use:
+
+ validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]']
+
+If a fourth argument is specified, this will be the error message raised and
+seen by the user.
+
+A helpful error message can be returned like this:
+
+ validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas')
+
+
+- *Type*: statement
+
validate_bool
-------------
Validate that all passed values are either true or false. Abort catalog
@@ -801,6 +833,29 @@ The following values will fail, causing compilation to abort:
- *Type*: statement
+
+validate_cmd
+-------------
+Perform validation of a string with an external command.
+The first argument of this function should be a string to
+test, and the second argument should be a path to a test command
+taking a file as last argument. If the command, launched against
+a tempfile containing the passed string, returns a non-null value,
+compilation will abort with a parse error.
+
+If a third argument is specified, this will be the error message raised and
+seen by the user.
+
+A helpful error message can be returned like this:
+
+Example:
+
+ validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content')
+
+
+
+- *Type*: statement
+
validate_hash
-------------
Validate that all passed values are hash data structures. Abort catalog