diff options
author | Dan Bode <dan@puppetlabs.com> | 2012-08-15 15:57:45 -0700 |
---|---|---|
committer | Dan Bode <dan@puppetlabs.com> | 2012-08-15 15:57:45 -0700 |
commit | 5d99cdf09c08f3161435ffdd2a2b666106386979 (patch) | |
tree | 0cf6a19d74e8f2a8522052114fc7758dd049cac8 /lib | |
parent | b42c82af19f64ed4398863092971c7ba81298a02 (diff) |
Explicitly load functions used by ensure_resource
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/ensure_resource.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/ensure_resource.rb b/lib/puppet/parser/functions/ensure_resource.rb index 6a9e2ed..fba2035 100644 --- a/lib/puppet/parser/functions/ensure_resource.rb +++ b/lib/puppet/parser/functions/ensure_resource.rb @@ -25,9 +25,11 @@ ENDOFDOC raise(ArgumentError, 'Must specify a type') unless type raise(ArgumentError, 'Must specify a title') unless title params ||= {} + Puppet::Parser::Functions.function(:defined_with_params) if function_defined_with_params(["#{type}[#{title}]", params]) Puppet.debug("Resource #{type}[#{title}] not created b/c it already exists") else + Puppet::Parser::Functions.function(:create_resources) function_create_resources([type.capitalize, { title => params }]) end end |