diff options
author | Dan Bode <dan@puppetlabs.com> | 2012-08-15 15:57:45 -0700 |
---|---|---|
committer | Jeff McCune <jeff@puppetlabs.com> | 2012-10-25 10:57:40 -0700 |
commit | 9fc3063ea954bbd49cd2b8386bc69696a4af4114 (patch) | |
tree | edb57c2cf326241c762052ab6431d96f464f6033 /lib/puppet/parser/functions/ensure_resource.rb | |
parent | 699d520e72014a3a17395c52c04f5b521d1318e6 (diff) | |
download | puppet-stdlib-9fc3063ea954bbd49cd2b8386bc69696a4af4114.tar.gz puppet-stdlib-9fc3063ea954bbd49cd2b8386bc69696a4af4114.tar.bz2 |
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/puppet/parser/functions/ensure_resource.rb')
-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 |