@@ -381,22 +381,54 @@ the type and parameters specified if it doesn't already exist.
381381
382382file_line
383383---------
384- This resource ensures that a given line is contained within a file. You can also use
385- "match" to replace existing lines.
384+ Ensures that a given line is contained within a file. The implementation
385+ matches the full line, including whitespace at the beginning and end. If
386+ the line is not contained in the given file, Puppet will add the line to
387+ ensure the desired state. Multiple resources may be declared to manage
388+ multiple lines in the same file.
386389
387390* Examples:*
388391
389392 file_line { 'sudo_rule':
390393 path => '/etc/sudoers',
391394 line => '%sudo ALL=(ALL) ALL',
392395 }
393-
394- file_line { 'change_mount':
395- path => '/etc/fstab',
396- line => '10.0.0.1:/vol/data /opt/data nfs defaults 0 0',
397- match => '^172.16.17.2:/vol/old',
396+ file_line { 'sudo_rule_nopw':
397+ path => '/etc/sudoers',
398+ line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',
398399 }
399400
401+ In this example, Puppet will ensure both of the specified lines are
402+ contained in the file /etc/sudoers.
403+
404+ * Parameters within ` file_line ` :*
405+
406+ ** ` after ` **
407+
408+ An optional value used to specify the line after which we will add any new
409+ lines. (Existing lines are added in place)
410+
411+ ** ` line ` **
412+
413+ The line to be appended to the file located by the path parameter.
414+
415+ ** ` match ` **
416+
417+ An optional regular expression to run against existing lines in the file;
418+ if a match is found, we replace that line rather than adding a new line.
419+
420+ ** ` multiple ` **
421+
422+ An optional value to determine if match can change multiple lines.
423+
424+ ** ` name ` **
425+
426+ An arbitrary name used as the identity of the resource.
427+
428+ ** ` path ` **
429+
430+ The file Puppet will ensure contains the line specified by the line parameter.
431+
400432- * Type* : resource
401433
402434flatten
@@ -840,6 +872,13 @@ Will return: ["a","b","c"]
840872
841873Will return: [ "host01", "host02", ..., "host09", "host10"]
842874
875+ Passing a third argument will cause the generated range to step by that
876+ interval, e.g.
877+
878+ range("0", "9", "2")
879+
880+ Will return: [ 0,2,4,6,8]
881+
843882- * Type* : rvalue
844883
845884reject
@@ -1328,21 +1367,22 @@ A helpful error message can be returned like this:
13281367validate_slength
13291368----------------
13301369Validate that the first argument is a string (or an array of strings), and
1331- less/equal to than the length of the second argument. It fails if the first
1332- argument is not a string or array of strings, and if arg 2 is not convertable
1333- to a number.
1370+ less/equal to than the length of the second argument. An optional third
1371+ parameter can be given a the minimum length. It fails if the first
1372+ argument is not a string or array of strings, and if arg 2 and arg 3 are
1373+ not convertable to a number.
13341374
13351375The following values will pass:
13361376
13371377 validate_slength("discombobulate",17)
13381378 validate_slength(["discombobulate","moo"],17)
1379+ validate_slength(["discombobulate","moo"],17,3)
13391380
13401381The following values will not:
13411382
13421383 validate_slength("discombobulate",1)
13431384 validate_slength(["discombobulate","thermometer"],5)
1344-
1345-
1385+ validate_slength(["discombobulate","moo"],17,10)
13461386
13471387- * Type* : statement
13481388
0 commit comments