summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/ensure_resource.rb
AgeCommit message (Collapse)Author
2014-10-10ensure_resource: be more verbose in debug modeMathias Klette
helps discovering duplication issues, especially when figthing boolean vs. string arguments
2013-06-27ensure_resource: fix documentation typoChris Boot
2013-05-06Terser method of string to array conversion courtesy of ethooz.Alex Cline
2013-05-06Changed str-to-array conversion and removed abbreviation.Alex Cline
2013-05-03(#20548) Allow an array of resource titles to be passed into the ↵Alex Cline
ensure_resource function This patch allows an array of resource titles to be passed into the ensure_resource function. Each item in the array will be checked for existence and will be created if it doesn't already exist.
2012-08-15Explicitly load functions used by ensure_resourceDan Bode
The ensure_resource function actually calls two other functions, create_resources and defined_with_param. When calling Puppet functions from Ruby, you sometimes have to load the functions manually if they have not been called before. This commit explicitly loads the functions that ensure_resource depends on from within the function.
2012-08-15Revert "Revert "Merge pull request #86 from bodepd/ensure_resource""Dan Bode
This reverts commit 1e0983362464e8f2832239b09cdbc9175a51e6ec.
2012-08-14Revert "Merge pull request #86 from bodepd/ensure_resource"Jeff McCune
This reverts commit 42ddd7fe54f37b84e34b4a005de2249e53f07469, reversing changes made to 53243605b28fc31618d079155c86b37b4e88a6ca.
2012-08-13re-formattingDan Bode
This commit refactors to ensure 80 character lines.
2012-08-13Add better docs about duplicate resource failuresDan Bode
This commit adds better inline documentation explaining how replicate resource definitions can occur if the resource exists and does not have matching parameters.
2012-08-13Add function ensure_resource and defined_with_paramsDan Bode
This commit adds 2 new functions with unit tests. defined_with_params works similarily to puppet's defined function, except it allows you to also specify a hash of params. defined_with_params will return true if a resource also exists that matches the specified type/title (just like with defined) as well as all of the specified params. ensure_resource is a function that basically combines defined_with_params with create_resources to conditionally create resources only if the specified resource (title, type, params) does not already exist. These functions are created to serve as an alternative to using defined as follows: if ! defined(Package['some_package']) { package { 'some_package': ensure => present, } The issue with this usage is that there is no guarentee about what parameters were set in the previous definition of the package that made its way into the catalog. ensure_resource could be used instead, as: ensure_resource('package', 'some_package', { 'ensure' => 'present' }) This will creat the package resources only if another resource does not exist with the specified parameters.