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

undefined method `pretty_generate' for Puppet::Pops::Loader::RubyFunctionInstantiator::JSON:Module #24

Closed
bastelfreak opened this issue Oct 30, 2019 · 3 comments · Fixed by #25

Comments

@bastelfreak
Copy link

bastelfreak commented Oct 30, 2019

Description of problem

During a puppet run, I get the following error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `pretty_generate' for Puppet::Pops::Loader::RubyFunctionInstantiator::JSON:Module (file: /etc/puppetlabs/code/environments/production/modules/vault/manifests/config.pp, line: 30, column: 16) on node vault

  • What did you expect to happen?

to compile into a catalog

  • How can someone reproduce the problem?

It should be enough to do a include vault + having the sensuclassic module in the environment.

Command used and debugging output

  • What does your puppet config look like (including any hiera config)

There is no sensu related config on the affected machine

  • Is this a masterless or master based puppet setup?

master

Platform and version information

  • Your OS: Arch Linux
  • Your Ruby version: 2.6.4
  • Your version of Puppet: 5.5.17
  • Your version of Sensu: there is no sensu installed
  • Your version of this module: v3.4.0

Anything else to add that you think will be helpful?

The vault module uses to_json_pretty from stdlib:
https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/functions/to_json_pretty.rb#L75

It basically calls JSON.pretty_generate(). That method is provided by the default json module from the ruby core lib. My guess is that the module JSON overwrites the class from the core lib.

The methods validate_keys(), sorted_generate() and sorted_pretty_generate() should probably extend the json class or stay within the scope of this module?

@bastelfreak bastelfreak changed the title Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `pretty_generate' for Puppet::Pops::Loader::RubyFunctionInstantiator::JSON:Module undefined method `pretty_generate' for Puppet::Pops::Loader::RubyFunctionInstantiator::JSON:Module Oct 30, 2019
@bastelfreak
Copy link
Author

I did some further digging and I'm not 100% sure if this issue is related to this module. I had a few other environments laying around that contain the consul module before this was merged: voxpupuli/puppet-consul#456. Puppetserver is still not really good at environment isolation.

@treydock
Copy link
Collaborator

@bastelfreak I opened #25 just to rule out our monkey patch.

The only environment isolation issues I've run into with Puppetserver is for custom types/providers and that was solved with generating types for each environment when r10k is run.

@bastelfreak
Copy link
Author

Thank you very much for the patch. I am happy to test this tomorrow. R10k is called with --generate-types for each run, so types shouldn't be an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants