Jeff McCune [Fri, 30 Dec 2011 19:46:21 +0000 (11:46 -0800)]
(maint) Add semantic versioning info to README
This patch adds semantic versioning information to the README of this
module. This information is missing and unclear without this patch.
This should help clarify the support matrix for the Standard Library as
it relates to Puppet Enterprise released versions.
nfagerlund [Wed, 17 Aug 2011 22:55:07 +0000 (15:55 -0700)]
Docs: Remove author emails from stdlib functions
Author email addresses were included in the doc strings for some (but not all)
stdlib functions. This commit removes them in the interest of consistency.
nfagerlund [Wed, 17 Aug 2011 22:20:26 +0000 (15:20 -0700)]
Docs: Correct indentation of markdown code examples
Code examples in several function doc strings were only indented by two
spaces, which would not result in proper display when rendered as HTML. This
commit corrects the indentation to four spaces.
Jeff McCune [Tue, 16 Aug 2011 22:57:47 +0000 (15:57 -0700)]
Docs: Improve example in merge function
This commit replaces the example in the merge function with a much clearer
one. It also mentions that the rightmost value wins in the event of duplicated
hash keys.
Jeff McCune [Thu, 18 Aug 2011 17:44:40 +0000 (10:44 -0700)]
(#9080) Make facts.d match Facter 2.0
Based on feedback from Luke, the facts.d directory should at least match
the directory that will be used by Facter 2.0.
Reading #2157 I believe the Facter 2.0 facts.d feature is reasonably API
compatible with this custom fact from R.I. so I'm comfortable using the
same filesystem path.
Change in behavior: Now look for facts in:
* /etc/facter/facts.d
* /etc/puppetlabs/facter/facts.d
The mcollectivepe module relies on these facts being set and we need a
persistent place to write them during the interview process and later
read them when puppet agent runs to configure MCollective on the agent
systems.
Since stdlib is a public module, both /etc/facts.d and
/etc/puppetlabs/facts.d are scanned for static facts.
Jeff McCune [Mon, 8 Aug 2011 16:33:56 +0000 (09:33 -0700)]
(#8792) Rename basic smoke test to reflect file_line rename
Without this patch the basic smoke test in the module tests/ directory
did not math up with the renamed whole_line => file_line resource type.
This patch updates the smoke test file to match the most recently
selected name of file_line. The filename has been changed, comments
added to the smoke test file, and resource declarations inside the file
changed.
Jeff McCune [Fri, 5 Aug 2011 02:17:48 +0000 (19:17 -0700)]
(#8792) Rename whole_line type to file_line
Without this patch the resource whole_line would be included in the
stable stdlib module shipping in PE 1.2. Ideally the name will be
stable and unchanging in the future.
There was quite a bit of concern over whole_line being an unwise name.
file_line appears to be the most suitable name and least likely to need
another rename in the future.
Jeff McCune [Mon, 25 Jul 2011 17:42:27 +0000 (10:42 -0700)]
(#8575) Add loadyaml() function
This change adds a loadyaml() puppet function that takes a path to a
YAML data file and returns the contents as a Puppet variable. There is
currently no validation of the contents of the file.
This commit is intentionally lacking unit tests because of time
constraints.
Jeff McCune [Mon, 20 Jun 2011 23:05:18 +0000 (16:05 -0700)]
Remove metadata.json from repository
This file is generated from the puppet-module build command and should
not be included in the repository. If it is, the repository is not
directly usable on a Puppet master because the metadata.json is invalid.
Jeff McCune [Wed, 15 Jun 2011 16:43:22 +0000 (09:43 -0700)]
(#3) Add simple unit test for anchor type
Unlike the whit type the anchor type derives from, we are not hacking
the stringify method. We expect the resource to be named simply
Anchor[foo::bar] where the name is "foo::bar".
Jeff McCune [Wed, 15 Jun 2011 16:40:04 +0000 (09:40 -0700)]
(#3) Add an anchor type to provide containment
With Puppet 2.6.x we do not have a way to specify containment
relationships. In the use case of class ntp { } declaring
ntp::{package,config,service} classes, the ntp class itself should allow
the user to specify before and require relationships to the main ntp
class.
The anchor resource type allows module authors to close the loop on
classes composing the main top level module. For example:
class ntp {
class { 'ntp::package': }
-> class { 'ntp::config': }
-> class { 'ntp::service': }
# These two resources "anchor" the composed classes
# such that the end user may use "require" and "before"
# relationships with Class['ntp']
anchor { 'ntp::begin': } -> class { 'ntp::package': }
class { 'ntp::service': } -> anchor { 'ntp::end': }
}
Using this pattern, the module user may then simply declare relationships to
the ntp class as they expect:
class { 'ntp': } -> class { 'mcollective': }
# OR
class { 'mcollective': } -> class { 'ntp': }
Jeff McCune [Fri, 3 Jun 2011 18:41:20 +0000 (11:41 -0700)]
Add spec test for validate_bool function
This is an interesting spec test for module developers.
It illustrates how to cause Puppet to test the function
from the Puppet DSL rather than the Ruby DSL, fully
exercising the system from the perspective of the end
user.
(Note how Puppet[:code] is set, then the scope reset, then
the compile method called.)
Jeff McCune [Fri, 3 Jun 2011 18:39:45 +0000 (11:39 -0700)]
Add validate_bool() function to stdlib
This function aborts catalog compilation if any of the passed
values are not true or false. Note, this catches the string
values of true and false correct and will abort catalog
compilation if they are not boolean values.
Jeff McCune [Thu, 26 May 2011 17:21:42 +0000 (10:21 -0700)]
Move stages to after main
Working with the stages in stdlib, I quickly ran into an issue where
most of the stages were before the main stage. This made it difficult
to declare any resources in a traditional "include" style class while
hiding the end user from the stages being associated with other module
classes.
For example, in class mcollective, a package would be declared in main.
However, if mcollective declared class mcollective::service in stage
infra_deploy and this was before main, there would be a dependency loop
between the package and the service.
There appears to be a convention around "chain your stages after main"
to avoid the need to create relatively empty shell classes.
Jeff McCune [Wed, 25 May 2011 19:38:15 +0000 (12:38 -0700)]
(#7657) Add basic validate_re function
While developing Puppet Modules with class parameters, data from the
user should be validated as per the Style Guide. Puppet should fail
early and hard in the situation of invalid data being passed into the
module.
This function provides a more concise method to the alternative of using
if statements in the Puppet manifests.
Jeff McCune [Tue, 24 May 2011 18:25:51 +0000 (11:25 -0700)]
Add standard set of run stages.
Many modules I'm working on need a standard but
relatively granular location in the catalog. For example,
any module that configures the packaging system should
run "early"
Add the following stages which have inter-dependencies
in the top to bottom order listed: