Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pseudo-relative include paths in parser-function and type. #19

Merged

Conversation

olifre
Copy link
Contributor

@olifre olifre commented Sep 27, 2017

This fixes #8 and #14 in our setup (Puppet 5.2.0).

The underlying cause is described at:
https://tickets.puppetlabs.com/browse/SERVER-973
Without manually patching puppetserver's load path, the only other workaround would be to use something more complex like:
https://github.com/nanliu/puppet-archive/blob/766062a3465053ca8a326ea0b3c31648a49474a4/lib/puppet/provider/archive/default.rb#L1-L10

I guess it's patched somewhere in Puppet Enterprise's puppetserver, which might be the cause why it works for some people.

@logicminds
Copy link

nice digging around. I remember this problem but just never connected the two.

@@ -1,4 +1,4 @@
require 'puppet_x/binford2k/node_encrypt'
require File.join(File.dirname(__FILE__), '../..', 'puppet_x/binford2k/node_encrypt.rb')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you validate this on a windows node? It should work, since the win32 filesystem APIs all recognize the forward slash as a directory separator. But I'd like to validate that before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sadly don't have access to a Windows node as of yet...
We are still fighting with the Puppet 5 upgrade and improving Foreman integration here ;-).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a

require File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'puppet_x/binford2k/node_encrypt.rb') would help on windows.

@binford2k
Copy link
Member

I guess it's patched somewhere in Puppet Enterprise's puppetserver, which might be the cause why it works for some people.

You're totally right. Now that I read a bit further I see that. PE adds the agent libdir to the Puppetserver load path and I didn't realize until just now that ootb Puppetserver did not! Thanks for catching that.

@binford2k
Copy link
Member

I swapped out for require_relative and all the specs pass. Thanks!

(I didn't bother to change the one in the face, it's going to use the synced load path anyway)

@binford2k binford2k merged commit 8911334 into puppetlabs:master Oct 26, 2017
@logicminds
Copy link

I feel vindicated. @binford2k

@olifre olifre deleted the use-pseudo-relative-ruby-file-paths branch October 26, 2017 13:47
cegeka-jenkins pushed a commit to cegeka/puppet-node_encrypt that referenced this pull request Aug 1, 2019
…y-file-paths

Use pseudo-relative include paths in parser-function and type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

puppet server cannot load library when calling function
4 participants