X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;ds=sidebyside;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fensure_resource.rb;h=d28ed9db74aa55e3608d28348aa55d58520a6aba;hb=131e09855e065be940e104d9ab0f18940cc76257;hp=1ba6a44782dafb34a7829db5372f0ee70ea330ad;hpb=407d322498f4fde815abf381007fbecfe5c10b2b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb index 1ba6a4478..d28ed9db7 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb @@ -3,29 +3,29 @@ require 'puppet/parser/functions' Puppet::Parser::Functions.newfunction(:ensure_resource, :type => :statement, - :doc => <<-'ENDOFDOC' -Takes a resource type, title, and a list of attributes that describe a -resource. + :doc => <<-'DOC' + Takes a resource type, title, and a list of attributes that describe a + resource. - user { 'dan': - ensure => present, - } + user { 'dan': + ensure => present, + } -This example only creates the resource if it does not already exist: + This example only creates the resource if it does not already exist: - ensure_resource('user', 'dan', {'ensure' => 'present' }) + ensure_resource('user', 'dan', {'ensure' => 'present' }) -If the resource already exists but does not match the specified parameters, -this function will attempt to recreate the resource leading to a duplicate -resource definition error. + If the resource already exists but does not match the specified parameters, + this function will attempt to recreate the resource leading to a duplicate + resource definition error. -An array of resources can also be passed in and each will be created with -the type and parameters specified if it doesn't already exist. + An array of resources can also be passed in and each will be created with + the type and parameters specified if it doesn't already exist. - ensure_resource('user', ['dan','alex'], {'ensure' => 'present'}) + ensure_resource('user', ['dan','alex'], {'ensure' => 'present'}) -ENDOFDOC -) do |vals| +DOC + ) do |vals| type, title, params = vals raise(ArgumentError, 'Must specify a type') unless type raise(ArgumentError, 'Must specify a title') unless title