Skip to content

Commit 0b4822b

Browse files
committed
Merge pull request puppetlabs#557 from jbondpdx/4.10.x
edits to README
2 parents 9a1d8be + 8fcefcf commit 0b4822b

File tree

1 file changed

+35
-54
lines changed

1 file changed

+35
-54
lines changed

README.markdown

Lines changed: 35 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ The `stdlib::stages` class declares various run stages for deploying infrastruct
7777

7878
#### `file_line`
7979

80-
Ensures that a given line is contained within a file. The implementation
81-
matches the full line, including whitespace at the beginning and end. If
82-
the line is not contained in the given file, Puppet will append the line to
83-
the end of the file to ensure the desired state. Multiple resources may
84-
be declared to manage multiple lines in the same file.
80+
Ensures that a given line is contained within a file. The implementation matches the full line, including whitespace at the beginning and end. If the line is not contained in the given file, Puppet appends the line to the end of the file to ensure the desired state. Multiple resources can be declared to manage multiple lines in the same file.
8581

8682
Example:
8783

@@ -95,8 +91,7 @@ Example:
9591
line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',
9692
}
9793

98-
In this example, Puppet will ensure both of the specified lines are
99-
contained in the file /etc/sudoers.
94+
In this example, Puppet ensures that both of the specified lines are contained in the file `/etc/sudoers`.
10095

10196
Match Example:
10297

@@ -107,8 +102,7 @@ Match Example:
107102
match => '^export\ HTTP_PROXY\=',
108103
}
109104

110-
In this code example match will look for a line beginning with export
111-
followed by HTTP_PROXY and replace it with the value in line.
105+
In this code example, `match` looks for a line beginning with export followed by HTTP_PROXY and replaces it with the value in line.
112106

113107
Match Example With `ensure => absent`:
114108

@@ -120,20 +114,20 @@ Match Example With `ensure => absent`:
120114
match_for_absence => true,
121115
}
122116

123-
In this code example match will look for a line beginning with export
117+
In this code example, `match` looks for a line beginning with export
124118
followed by HTTP_PROXY and delete it. If multiple lines match, an
125119
error will be raised unless the `multiple => true` parameter is set.
126120

127-
**Autorequires:** If Puppet is managing the file that will contain the line
128-
being managed, the file_line resource will autorequire that file.
121+
**Autorequires:** If Puppet is managing the file that contains the line being managed, the `file_line` resource autorequires that file.
129122

130123
##### Parameters
124+
131125
All parameters are optional, unless otherwise noted.
132126

133-
* `after`: Specifies the line after which Puppet will add any new lines. (Existing lines are added in place.) Valid options: String. Default: Undefined.
127+
* `after`: Specifies the line after which Puppet adds any new lines. (Existing lines are added in place.) Valid options: String. Default: Undefined.
134128
* `ensure`: Ensures whether the resource is present. Valid options: 'present', 'absent'. Default: 'present'.
135129
* `line`: **Required.** Sets the line to be added to the file located by the `path` parameter. Valid options: String. Default: Undefined.
136-
* `match`: Specifies a regular expression to run against existing lines in the file; if a match is found, it is replaced rather than adding a new line. A regex comparison is performed against the line value and if it does not match an exception will be raised. Valid options: String containing a regex. Default: Undefined.
130+
* `match`: Specifies a regular expression to run against existing lines in the file; if a match is found, it is replaced rather than adding a new line. A regex comparison is performed against the line value, and if it does not match, an exception is raised. Valid options: String containing a regex. Default: Undefined.
137131
* `match_for_absence`: An optional value to determine if match should be applied when `ensure => absent`. If set to true and match is set, the line that matches match will be deleted. If set to false (the default), match is ignored when `ensure => absent` and the value of `line` is used instead. Default: false.
138132
* `multiple`: Determines if `match` and/or `after` can change multiple lines. If set to false, an exception will be raised if more than one line matches. Valid options: 'true', 'false'. Default: Undefined.
139133
* `name`: Sets the name to use as the identity of the resource. This is necessary if you want the resource namevar to differ from the supplied `title` of the resource. Valid options: String. Default: Undefined.
@@ -172,10 +166,7 @@ Converts a boolean to a number. Converts values:
172166

173167
#### `bool2str`
174168

175-
Converts a boolean to a string using optionally supplied arguments. The optional
176-
second and third arguments represent what true and false will be converted to
177-
respectively. If only one argument is given, it will be converted from a boolean
178-
to a string containing 'true' or 'false'.
169+
Converts a boolean to a string using optionally supplied arguments. The optional second and third arguments represent what true and false are converted to respectively. If only one argument is given, it is converted from a boolean to a string containing 'true' or 'false'.
179170

180171
*Examples:*
181172
~~~
@@ -188,7 +179,7 @@ Requires a single boolean as input. *Type*: rvalue.
188179

189180
#### `capitalize`
190181

191-
Capitalizes the first character of a string or array of strings, and lower-cases the remaining characters of each string. Requires either a single string or an array as an input. *Type*: rvalue.
182+
Capitalizes the first character of a string or array of strings and lowercases the remaining characters of each string. Requires either a single string or an array as an input. *Type*: rvalue.
192183

193184
#### `ceiling`
194185

@@ -336,10 +327,13 @@ fqdn_rand_string(10, '', 'custom seed')
336327
Rotates an array or string a random number of times, combining the `$fqdn` fact and an optional seed for repeatable randomness.
337328

338329
*Usage:*
330+
339331
~~~
340332
fqdn_rotate(VALUE, [SEED])
341333
~~~
334+
342335
*Examples:*
336+
343337
~~~
344338
fqdn_rotate(['a', 'b', 'c', 'd'])
345339
fqdn_rotate('abcd')
@@ -459,7 +453,7 @@ Returns an array an intersection of two. For example, `intersection(["a","b","c"
459453

460454
#### `is_a`
461455

462-
Boolean check to determine whether a variable is of a given data type. This is equivalent to the `=~` type checks. This function is only available in Puppet 4, or when using the "future" parser.
456+
Boolean check to determine whether a variable is of a given data type. This is equivalent to the `=~` type checks. This function is available only in Puppet 4 or in Puppet 3 with the "future" parser.
463457

464458
~~~
465459
foo = 3
@@ -477,8 +471,8 @@ Boolean check to determine whether a variable is of a given data type. This is e
477471
}
478472
~~~
479473

480-
See the documentation for "The Puppet Type System" for more information about types.
481-
See the `assert_type()` function for flexible ways to assert the type of a value.
474+
See the [the Puppet type system](https://docs.puppetlabs.com/references/latest/type.html#about-resource-types) for more information about types.
475+
See the [`assert_type()`](https://docs.puppetlabs.com/references/latest/function.html#asserttype) function for flexible ways to assert the type of a value.
482476

483477
#### `is_array`
484478

@@ -555,7 +549,7 @@ Loads the metadata.json of a target module. Can be used to determine module vers
555549
notify { $metadata['author']: }
556550
~~~
557551

558-
If you do not want to fail the catalog compilation if the metadata file for a module is not present:
552+
If you do not want to fail the catalog compilation when a module's metadata file is absent:
559553

560554
~~~
561555
$metadata = load_module_metadata('mysql', true)
@@ -606,13 +600,11 @@ Converts a number or a string representation of a number into a true boolean. Ze
606600

607601
#### `parsejson`
608602

609-
Converts a string of JSON into the correct Puppet structure. *Type*: rvalue.
610-
The optional second argument will be returned if the data was not correct.
603+
Converts a string of JSON into the correct Puppet structure. *Type*: rvalue. The optional second argument is returned if the data was not correct.
611604

612605
#### `parseyaml`
613606

614-
Converts a string of YAML into the correct Puppet structure. *Type*: rvalue.
615-
The optional second argument will be returned if the data was not correct.
607+
Converts a string of YAML into the correct Puppet structure. *Type*: rvalue. The optional second argument is returned if the data was not correct.
616608

617609
#### `pick`
618610

@@ -626,7 +618,7 @@ From a list of values, returns the first value that is not undefined or an empty
626618

627619
#### `pick_default`
628620

629-
Will return the first value in a list of values. Contrary to the 'pick()' function, the 'pick_default()' does not fail if all arguments are empty. This allows it to use an empty value as default. *Type*: rvalue.
621+
Returns the first value in a list of values. Contrary to the `pick()` function, the `pick_default()` does not fail if all arguments are empty. This allows it to use an empty value as default. *Type*: rvalue.
630622

631623
#### `prefix`
632624

@@ -699,9 +691,7 @@ Strips spaces to the right of the string. *Type*: rvalue.
699691

700692
#### `seeded_rand`
701693

702-
Takes an integer max value and a string seed value and returns a
703-
repeatable random integer smaller than max. Like `fqdn_rand`, but
704-
this does not add node specific data to the seed. *Type*: rvalue.
694+
Takes an integer max value and a string seed value and returns a repeatable random integer smaller than max. Like `fqdn_rand`, but does not add node specific data to the seed. *Type*: rvalue.
705695

706696
#### `shuffle`
707697

@@ -721,7 +711,7 @@ Returns a new string where runs of the same character that occur in this set are
721711

722712
#### `str2bool`
723713

724-
Converts certain strings to a boolean. This attempts to convert strings that contain the values '1', 't', 'y', and 'yes' to 'true'. Strings that contain values '0', 'f', 'n', and 'no', or are an an empty string or undefined are converted to 'false'. Any other value will cause an error. *Type*: rvalue.
714+
Converts certain strings to a boolean. This attempts to convert strings that contain the values '1', 't', 'y', or 'yes' to true. Strings that contain values '0', 'f', 'n', or 'no', or that are an empty string or undefined are converted to false. Any other value causes an error. *Type*: rvalue.
725715

726716
#### `str2saltedsha512`
727717

@@ -804,18 +794,11 @@ Converts the argument into bytes, for example "4 kB" becomes "4096". Takes a sin
804794

805795
*Type*: rvalue.
806796

807-
Looks up into a complex structure of arrays and hashes to extract a value by
808-
its path in the structure. The path is a string of hash keys or array indexes
809-
starting with zero, separated by the path separator character (default "/").
810-
The function will go down the structure by each path component and will try to
811-
return the value at the end of the path.
797+
Retrieves a value within multiple layers of hashes and arrays via a string containing a path. The path is a string of hash keys or array indexes starting with zero, separated by the path separator character (default "/"). The function goes through the structure by each path component and tries to return the value at the end of the path.
812798

813-
In addition to the required "path" argument the function accepts the default
814-
argument. It will be returned if the path is not correct, no value was found or
815-
a any other error have occurred. And the last argument can set the path
816-
separator character.
799+
In addition to the required path argument, the function accepts the default argument. It is returned if the path is not correct, if no value was found, or if any other error has occurred. The last argument can set the path separator character.
817800

818-
```ruby
801+
~~~ruby
819802
$data = {
820803
'a' => {
821804
'b' => [
@@ -840,7 +823,7 @@ $value = try_get_value($data, 'a/b/c/d', 'not_found')
840823
# using custom separator
841824
$value = try_get_value($data, 'a|b', [], '|')
842825
# $value = ['b1','b2','b3']
843-
```
826+
~~~
844827

845828
1. **$data** The data structure we are working with.
846829
2. **'a/b/2'** The path string.
@@ -1087,9 +1070,8 @@ Validates that the first argument is an integer (or an array of integers). Abort
10871070

10881071
#### `validate_ip_address`
10891072

1090-
Validates that argument is an IP address, regardless of it is an IPv4 or an IPv6
1091-
address. It validates as well IP address with netmask. It must be an String, as
1092-
well.
1073+
Validates that the argument is an IP address, regardless of it is an IPv4 or an IPv6
1074+
address. It also validates IP address with netmask. The argument must be given as a string.
10931075

10941076
The following values will pass:
10951077

@@ -1160,8 +1142,7 @@ test, and the second argument should be a stringified regular expression (withou
11601142
validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7')
11611143
~~~
11621144

1163-
Note: Compilation will also abort, if the first argument is not a String. Always use
1164-
quotes to force stringification:
1145+
Note: Compilation terminates if the first argument is not a string. Always use quotes to force stringification:
11651146

11661147
~~~
11671148
validate_re("${::operatingsystemmajrelease}", '^[57]$')
@@ -1171,7 +1152,7 @@ test, and the second argument should be a stringified regular expression (withou
11711152

11721153
#### `validate_slength`
11731154

1174-
Validates that the first argument is a string (or an array of strings), and is less than or equal to the length of the second argument. It fails if the first argument is not a string or array of strings, or if arg 2 is not convertable to a number. Optionally, a minimum string length can be given as the third argument.
1155+
Validates that the first argument is a string (or an array of strings), and is less than or equal to the length of the second argument. It fails if the first argument is not a string or array of strings, or if the second argument is not convertable to a number. Optionally, a minimum string length can be given as the third argument.
11751156

11761157
The following values pass:
11771158

@@ -1243,7 +1224,7 @@ Finds values inside an array based on location. The first argument is the array
12431224

12441225
Takes one element from first array given and merges corresponding elements from second array given. This generates a sequence of n-element arrays, where *n* is one more than the count of arguments. For example, `zip(['1','2','3'],['4','5','6'])` results in ["1", "4"], ["2", "5"], ["3", "6"]. *Type*: rvalue.
12451226

1246-
##Limitations
1227+
## Limitations
12471228

12481229
As of Puppet Enterprise 3.7, the stdlib module is no longer included in PE. PE users should install the most recent release of stdlib for compatibility with Puppet modules.
12491230

@@ -1259,13 +1240,13 @@ Versions | Puppet 2.6 | Puppet 2.7 | Puppet 3.x | Puppet 4.x |
12591240

12601241
**stdlib 5.x**: When released, stdlib 5.x will drop support for Puppet 2.7.x. Please see [this discussion](https://github.com/puppetlabs/puppetlabs-stdlib/pull/176#issuecomment-30251414).
12611242

1262-
##Development
1243+
## Development
12631244

1264-
Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)
1245+
Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide](https://docs.puppetlabs.com/forge/contributing.html).
12651246

12661247
To report or research a bug with any part of this module, please go to
12671248
[http://tickets.puppetlabs.com/browse/PUP](http://tickets.puppetlabs.com/browse/PUP).
12681249

1269-
##Contributors
1250+
## Contributors
12701251

1271-
The list of contributors can be found at: https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors
1252+
The list of contributors can be found at: [https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors](https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors).

0 commit comments

Comments
 (0)