The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
Ability to load a server side function from a server side function broken.
|Affected Puppet version:||2.6.6||Branch:|
Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com
This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.
In 0.24.9, the preferred way of loading a server side function to be used within another server side function was to do the following:
require File.join([File.expand_path(File.dirname(FILE)), ‘filename.rb’])
In 2.6.6, this does not work as Puppet attempts to load the file multiple times and the puppet run will not continue due to a duplicate load attempting to happen.
I’ve worked around this by doing the following, but it’s definitely a hack:
begin function_filename(‘%test_$string‘) rescue require File.join([File.expand_path(File.dirname(FILE)), 'filename.rb’]) end
In the called function, I just add something to return ‘true’ if that string is passed. Massive hack, but I couldn’t figure out another way to do it more elegantly.
#2 Updated by Anonymous about 3 years ago
- Status changed from Accepted to Needs More Information
- Assignee set to Anonymous
- Target version set to 2.7.5
I believe that this issue has been fixed by the code merged into 2.7.x at https://github.com/puppetlabs/puppet/commit/8012a7bbe4bcad46ca51edbc1d21f0701606ec5f The individual commit fixing this is https://github.com/puppetlabs/puppet/commit/37a19759950b817b285daa658ecbd3e4f827aa09
At this point you should be able to invoke
function_whatever and it will autoload appropriately for the environment with no additional work on your part.
Could you test that and confirm that it does fix your problem? I just want to double-check that before closing the ticket.