summaryrefslogtreecommitdiff
path: root/spec/functions/bool2str_spec.rb
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppet.com>2017-04-25 12:08:46 -0700
committerHunter Haugen <hunter@puppet.com>2017-04-25 17:12:33 -0700
commit4f19c27137d6de29ae63bf73115f1e8fefd00b03 (patch)
treec4dcfac3f10b5eab523a2406c03081259c02556f /spec/functions/bool2str_spec.rb
parentf15cc31041cb902d0025f1e35d9403956ad2fc79 (diff)
(PE-20308) Pass a literal type and not a string to findresource
- `defined_with_params` calls `findresource(reference.to_s)` - `findresource` is https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/parser/compiler.rb#L407 and points to https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L352 - This calls `Puppet::Resource.new` with the type https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L366 - This ends up calling `resource_type` via https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L317-L319 and that ends up declaring the type via the autoloader api at https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L390 - But why does the autoloader API fail to find it in the current environment? - Okay, so when the autoloader is trying to find the type, it uses the typeloader to look it up in the current environment https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/metatype/manager.rb#L171 - this calls `get_file` and `mark_loaded` https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/util/autoload.rb#L64-L67 Suggested workaround is to pass a literal type instead of a string to `findresource` to fix in stdlib, and also to fix loading/requiring of type in core puppet. This seems to affect more recent versions of puppet, so fallback to original behavior on pre-4.5
Diffstat (limited to 'spec/functions/bool2str_spec.rb')
0 files changed, 0 insertions, 0 deletions