puppetlabs/stdlib/2.4.0 |
|
|
Author: Puppet Labs
Tags:
|
|
How to Install
Puppet Labs Standard Library
This module provides a “standard library” of resources for developing Puppet Modules. This modules will include the following additions to Puppet
- Stages
- Facts
- Functions
- Defined resource types
- Types
- Providers
This module is officially curated and provided by Puppet Labs. The modules Puppet Labs writes and distributes will make heavy use of this standard library.
Versions
This module follows semver.org (v1.0.0) versioning guidelines. The standard library module is released as part of Puppet Enterprise and as a result older versions of Puppet Enterprise that Puppet Labs still supports will have bugfix maintenance branches periodically “merged up” into master. The current list of integration branches are:
- v2.1.x (v2.1.1 released in PE 1.2, 1.2.1, 1.2.3, 1.2.4)
- v2.2.x (Never released as part of PE, only to the Forge)
- v2.3.x (Scheduled for next PE feature release)
- master (mainline development branch)
The first Puppet Enterprise version including the stdlib module is Puppet Enterprise 1.2.
Compatibility
stdlib v2.1.x, v2.2.x
v2.1.x and v2.2.x of this module are designed to work with Puppet versions 2.6.x and 2.7.x. There are currently no plans for a Puppet 0.25 standard library module.
stdlib v2.3.x
While not yet released, the standard library may only work with Puppet 2.7.x.
Functions
Please see puppet doc -r function for documentation on each function. The
current list of functions is:
- getvar
- has_key
- loadyaml
- merge.rb
- validate_array
- validate_bool
- validate_hash
- validate_re
- validate_string
validate_hash
$somehash = { 'one' => 'two' }
validate\_hash($somehash)
getvar()
This function aims to look up variables in user-defined namespaces within puppet. Note, if the namespace is a class, it should already be evaluated before the function is used.
$namespace = 'site::data'
include "${namespace}"
$myvar = getvar("${namespace}::myvar")
Facts
Facts in /etc/facter/facts.d and /etc/puppetlabs/facter/facts.d are now loaded
automatically. This is a direct copy of R.I. Pienaar’s custom facter fact
located at:
https://github.com/ripienaar/facter-facts/tree/master/facts-dot-d
2012-06-07 - Chris Price - 2.4.0
* Add support for a 'match' parameter to file_line (a06c0d8)
2012-08-07 - Erik Dalén - 2.4.0
* (#15872) Add to_bytes function (247b69c)
2012-07-19 - Jeff McCune - 2.4.0
* (Maint) use PuppetlabsSpec::PuppetInternals.scope (master) (deafe88)
2012-07-10 - Hailee Kenney - 2.4.0
* (#2157) Make facts_dot_d compatible with external facts (5fb0ddc)
2012-03-16 - Steve Traylen - 2.4.0
* (#13205) Rotate array/string randomley based on fqdn, fqdn_rotate() (fef247b)
2012-05-22 - Peter Meier - 2.3.3
* fix regression in #11017 properly (f0a62c7)
2012-05-10 - Jeff McCune - 2.3.3
* Fix spec tests using the new spec_helper (7d34333)
2012-05-10 - Puppet Labs - 2.3.2
* Make file_line default to ensure => present (1373e70)
* Memoize file_line spec instance variables (20aacc5)
* Fix spec tests using the new spec_helper (1ebfa5d)
* (#13595) initialize_everything_for_tests couples modules Puppet ver (3222f35)
* (#13439) Fix MRI 1.9 issue with spec_helper (15c5fd1)
* (#13439) Fix test failures with Puppet 2.6.x (665610b)
* (#13439) refactor spec helper for compatibility with both puppet 2.7 and master (82194ca)
* (#13494) Specify the behavior of zero padded strings (61891bb)
2012-03-29 Puppet Labs - 2.1.3
* (#11607) Add Rakefile to enable spec testing
* (#12377) Avoid infinite loop when retrying require json
2012-03-13 Puppet Labs - 2.3.1
* (#13091) Fix LoadError bug with puppet apply and puppet_vardir fact
2012-03-12 Puppet Labs - 2.3.0
* Add a large number of new Puppet functions
* Backwards compatibility preserved with 2.2.x
2011-12-30 Puppet Labs - 2.2.1
* Documentation only release for the Forge
2011-12-30 Puppet Labs - 2.1.2
* Documentation only release for PE 2.0.x
2011-11-08 Puppet Labs - 2.2.0
* #10285 - Refactor json to use pson instead.
* Maint - Add watchr autotest script
* Maint - Make rspec tests work with Puppet 2.6.4
* #9859 - Add root_home fact and tests
2011-08-18 Puppet Labs - 2.1.1
* Change facts.d paths to match Facter 2.0 paths.
* /etc/facter/facts.d
* /etc/puppetlabs/facter/facts.d
2011-08-17 Puppet Labs - 2.1.0
* Add R.I. Pienaar's facts.d custom facter fact
* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are
automatically loaded now.
2011-08-04 Puppet Labs - 2.0.0
* Rename whole_line to file_line
* This is an API change and as such motivating a 2.0.0 release according to semver.org.
2011-08-04 Puppet Labs - 1.1.0
* Rename append_line to whole_line
* This is an API change and as such motivating a 1.1.0 release.
2011-08-04 Puppet Labs - 1.0.0
* Initial stable release
* Add validate_array and validate_string functions
* Make merge() function work with Ruby 1.8.5
* Add hash merging function
* Add has_key function
* Add loadyaml() function
* Add append_line native
2011-06-21 Jeff McCune - 0.1.7
* Add validate_hash() and getvar() functions
2011-06-15 Jeff McCune - 0.1.6
* Add anchor resource type to provide containment for composite classes
2011-06-03 Jeff McCune - 0.1.5
* Add validate_bool() function to stdlib
0.1.4 2011-05-26 Jeff McCune
* Move most stages after main
0.1.3 2011-05-25 Jeff McCune
* Add validate_re() function
0.1.2 2011-05-24 Jeff McCune
* Update to add annotated tag
0.1.1 2011-05-24 Jeff McCune
* Add stdlib::stages class with a standard set of stages
Copyright (C) 2011 Puppet Labs Inc
and some parts:
Copyright (C) 2011 Krzysztof Wilczynski
Puppet Labs can be contacted at: info@puppetlabs.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
anchor
-
Description
A simple resource type intended to be used as an anchor in a composite class.
In Puppet 2.6, when a class declares another class, the resources in the interior class are not contained by the exterior class. This interacts badly with the pattern of composing complex modules from smaller classes, as it makes it impossible for end users to specify order relationships between the exterior class and other modules.
The anchor type lets you work around this. By sandwiching any interior classes between two no-op resources that are contained by the exterior class, you can ensure that all resources in the module are contained.
class ntp { # These classes will have the correct order relationship with each # other. However, without anchors, they won't have any order # relationship to Class['ntp']. class { 'ntp::package': } -> class { 'ntp::config': } -> class { 'ntp::service': } # These two resources "anchor" the composed classes within the ntp # class. anchor { 'ntp::begin': } -> Class['ntp::package'] Class['ntp::service'] -> anchor { 'ntp::end': } }This allows the end user of the ntp module to establish require and before relationships with Class[‘ntp’]:
class { 'ntp': } -> class { 'mcollective': } class { 'mcollective': } -> class { 'ntp': } -
Parameters
- name
The name of the anchor resource.
-
Providers
-
-
file_line
-
Description
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 will add the line to ensure the desired state. Multiple resources may be declared to manage multiple lines in the same file. Example: file_line { 'sudo_rule': path => '/etc/sudoers', line => '%sudo ALL=(ALL) ALL', } file_line { 'sudo_rule_nopw': path => '/etc/sudoers', line => '%sudonopw ALL=(ALL) NOPASSWD: ALL', } In this example, Puppet will ensure both of the specified lines are contained in the file /etc/sudoers. -
Parameters
- name
An arbitrary name used as the identity of the resource.
- match
An optional regular expression to run against existing lines in the file;\nif a match is found, we replace that line rather than adding a new line.
- line
The line to be appended to the file located by the path parameter.
- path
The file Puppet will ensure contains the line specified by the line parameter.
-
Properties
- ensure
The basic property that the resource should be in. Valid values are
present,absent.
-
Providers
- ruby
-
