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

In Puppet 6, remove_undef_values doesn't work as expected #120

Closed
avidspartan1 opened this issue Oct 1, 2018 · 3 comments
Closed

In Puppet 6, remove_undef_values doesn't work as expected #120

avidspartan1 opened this issue Oct 1, 2018 · 3 comments

Comments

@avidspartan1
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.0.0
  • Ruby: 2.0.0p648
  • Distribution: RHEL 7
  • Module version: 3.1.0

How to reproduce (e.g Puppet code you use)

  1. Include the module in Puppet 6, any way you'd like.

What are you seeing

The puppet run fails due to trying to get the "length" member from a Nil object (because remove_undef_values does not remove the undef (Nil) value).

What behaviour did you expect instead

Puppet runs without errors.

Output log

Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method 'length' for nil:NilClass (file: /etc/puppetlabs/code/environments/production/modules/yum/manifests/init.pp, line: 222, column: 20) on node mynode.com.

Any additional information you'd like to impart

I'm submitting a PR to fix this issue by removing undefined values with a filter.

@cbb-colab
Copy link

cbb-colab commented Oct 4, 2018

I guess my (unexpected behaviour is similar, on my agent (linux, RHEL7) I got:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `length' for nil:NilClass (file: /etc/puppetlabs/code/environments/production/modules/yum/manifests/init.pp, line: 222, column: 20) on node template.test.intern

on the "puppet agent -t" command

Root cause was on the puppet master (linux, debian 9.5) I upgraded from puppet 5.5 to 6.0 (already installed "puppet module install puppet-yum --version 3.1.0" as of puppet 5.5)

In my site.pp I have the offending line/class

class { 'yum': manage_os_default_repos => true, }

which I now have to comment to let my puppet agent not to fail

Please fix, maybe the root cause is as written above

@avidspartan1
Copy link
Author

Take a look at my commit to see my fix to what the underlying problem is. The problem is that puppet's "remove_undef_values" method does not work as expected and even states in the ruby file that it is not the "best practice" way of removing undefined values.

@dhoppe
Copy link
Member

dhoppe commented Apr 5, 2019

I think this issue can be closed, since the pull request #121 was merged.

@dhoppe dhoppe closed this as completed Apr 5, 2019
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

No branches or pull requests

3 participants