The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #7444

Ability to load a server side function from a server side function broken.

Added by Trevor Vaughan about 3 years ago. Updated about 1 year ago.

Status:ClosedStart date:05/09/2011
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:functions
Target version:2.7.6
Affected Puppet version:2.6.6 Branch:
Keywords: customer

We've Moved!

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.


Description

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.

History

#1 Updated by Zach Leslie about 3 years ago

  • Status changed from Unreviewed to Accepted

#2 Updated by Anonymous almost 3 years ago

  • Status changed from Accepted to Needs More Information
  • Assignee set to Anonymous
  • Target version set to 2.7.5

G'day Trevor.

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.

Thanks,

Daniel

#3 Updated by Michael Stahnke almost 3 years ago

  • Target version changed from 2.7.5 to 2.7.6

This appears to be fixed in #4549 . What is the status of this ticket?

#4 Updated by Michael Stahnke over 2 years ago

  • Target version changed from 2.7.6 to 2.7.x

#5 Updated by James Turnbull over 2 years ago

  • Category set to functions
  • Status changed from Needs More Information to Closed

Fixed as dup of #4549.

#6 Updated by Matthaus Owens over 2 years ago

  • Target version changed from 2.7.x to 2.7.6

#7 Updated by Charlie Sharpsteen over 1 year ago

  • Keywords set to customer

#9 Updated by Anonymous about 1 year ago

  • Assignee deleted (Anonymous)

Also available in: Atom PDF