[PUP-7654] Upgrade to puppet5-nightly: undefined method `key_attributes' for nil:NilClass Created: 2017/06/12  Updated: 2019/04/04  Resolved: 2017/06/13

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: PUP 5.0.0
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Francois Lafont Assignee: Francois Lafont
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS: Ubuntu Trusty

Packages before the upgrade

puppet-agent: 1.10.1-1trusty (ie puppet version 4.10.1)
puppetserver: 2.7.2-1puppetlabs1
puppetdb-termini: 4.4.0-1puppetlabs1
puppetdb: 4.4.0-1puppetlabs1

Packages after the upgrade

puppet-agent: 4.99.0.202.ge36cade-1trusty (ie puppet version 5.0.0)
Other packages are unchanged


Attachments: File puppetserver.log    
Template:
Method Found: Needs Assessment
QA Risk Assessment: Needs Assessment

 Description   

Hi,

I have tried the upgrade to "Puppet5- nightly" (only the puppet-agent package) on a healthy and updated puppetserver. Here is the upgrade:

wget https://apt.puppetlabs.com/puppet5-nightly-release-trusty.deb
dpkg -i puppet5-nightly-release-trusty.deb
apt-get update
 
# I only upgrade puppet-agent.
#
# If I update puppetdb and puppetdb-termini too I have a puppetdb problem
# (see https://tickets.puppetlabs.com/browse/PDB-3550).
apt-get install puppet-agent
reboot

After the reboot, I try a puppet run:

~# /opt/puppetlabs/bin/puppet agent --test
Warning: Setting trusted_server_facts is deprecated. 
   (at /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/settings.rb:1159:in `issue_deprecation_warning')
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: undefined method `key_attributes' for nil:NilClass
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

In attachment, I have put the content of /var/log/puppetlabs/puppetserver/puppetserver.log during the puppet run.

Regards.



 Comments   
Comment by Kenn Hussey [ 2017/06/13 ]

Jeremy Barlow Ruth Linehan FYI.

Comment by Jeremy Barlow [ 2017/06/13 ]

Moses Mendoza - I seem to recall that you might have run into this error recently. Did you dig into it any further?

Where this appears to be in the puppetdb terminus code, maybe Russell Mull has some thoughts on this?

2017-06-13 03:48:21,920 ERROR [qtp752600666-66] [puppetserver] Puppet undefined method `key_attributes' for nil:NilClass
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:222:in `add_namevar_aliases'
org/jruby/RubyArray.java:1613:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/puppetdb.rb:213:in `add_namevar_aliases'
...

If this hasn't been done already, I think it would be good to update all three packages - puppet-agent, puppetserver, and puppetdb - to their latest puppet5_nightly versions and restart the puppetserver and puppetdb services (if not reboot the node). I'm not sure if this issue has something to do with an older PuppetDB terminus running with incompatible / newer puppet-agent code.

Comment by Russell Mull [ 2017/06/13 ]

I think this is because of

" # If I update puppetdb and puppetdb-termini too I have a puppetdb problem

  1. (see https://tickets.puppetlabs.com/browse/PDB-3550)."

It should work fine with the newer terminus.

Comment by Kenn Hussey [ 2017/06/13 ]

Francois Lafont please verify that updating to the newer terminus addresses your problem, thanks!

Comment by Francois Lafont [ 2017/06/13 ]

Kenn Hussey, indeed if I upgrade puppetdb-termini too, all seems to work:

# /opt/puppetlabs/bin/puppet agent --test
Warning: Setting trusted_server_facts is deprecated. 
   (at /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/settings.rb:1159:in `issue_deprecation_warning')
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for puppet.athome.priv
Info: Applying configuration version '1497395192'
Notice: Applied catalog in 2.56 seconds

In my first message, I hadn't upgraded puppetdb because it requires Java 8 and only Java 7 is available on Ubuntu Trusty (https://tickets.puppetlabs.com/browse/PDB-3550).

And I thought that I shouldn't upgrade puppetdb-termini too because I thought it was associated with the puppetdb version.

So now, if I want to test a complete puppet5 stack (with puppetdb too), I will have to install my lab in a OS which support Java 8 (so not Trusty).

Thanks for the help.

Comment by Christian Becker [ 2018/07/16 ]

In my case this was caused by CPR-565, so i'm linking this here in case somebody has this issue too.

Generated at Tue Jan 28 07:57:19 PST 2020 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.