diff options
author | Hunter Haugen <hunter@puppet.com> | 2017-04-25 12:08:46 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppet.com> | 2017-04-25 17:12:33 -0700 |
commit | 4f19c27137d6de29ae63bf73115f1e8fefd00b03 (patch) | |
tree | c4dcfac3f10b5eab523a2406c03081259c02556f /metadata.json | |
parent | f15cc31041cb902d0025f1e35d9403956ad2fc79 (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 'metadata.json')
0 files changed, 0 insertions, 0 deletions