Issue #5428 has been updated by Brice Figureau.

I got the same issue when migrating to 2.6.3.
Basically the problem is the following:

* under some version of 0.25 (potentially 0.25.4), resource references were not 
stored as strings (ie File[blah]) in the param values, but serialized as YAML.
* in 2.6, we removed Puppet::Resource::Reference, so the unserialization 
doesn't work anymore.

I see only one fix, reintroduce a stub Puppet::Resource::Reference class that 
does translate itself when unserialized from Yaml to real resource ref strings 
(if that's possible).
----------------------------------------
Bug #5428: Catalog compile fails citing to_hash error
https://projects.puppetlabs.com/issues/5428

Author: Eric Shamow
Status: Unreviewed
Priority: Urgent
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.6.3
Keywords: 
Branch: 


Running client and server 2.6.3.  CentOS 5.5 on both sides; Puppetmaster was 
upgraded from 0.25.4 -> 0.25.5 -> 2.6.2 -> 2.6.3.  Client is fresh build.

On every run of Puppet on particular hosts, we receive a variant the following 
error on both the agent and master:

Could not retrieve catalog from remote server: Error 400 on SERVER: undefined 
method `to_hash' for #<Puppet::Resource::Reference:0x2b38ce4140d8>

The situation was 100% reproduceable, but exhibits some strange behavior.  If 
the same client is moved to another Puppetmaster, running the same classes with 
the same manifest, compilation succeeds.  If the manifest is changed to include 
no classes, and then all classes are reintroduced one at a time, the client can 
be made to compile.  However once I point other clients at the new manifest 
with all classes included, they too fail.

Some googling turned up one link, an IRC log 
(http://pelin.lovedthanlost.net/puppet/%23puppet-2010-11-19.log.html) which 
suggested that the problematic code was located in resource.rb.  Line 123 of 
resource.rb is:
       return false unless to_hash == other.to_hash

Running with this, I wrapped that line in a rescue block:

    begin
       return false unless to_hash == other.to_hash
    rescue => e
       Puppet.notice "#{e} - Lost it on #{other.title}"
       return false
    end

I return false based on the assumption that, if a hash value cannot be 
calculated, then the two objects are not equivalent.  Running this, I end up 
with lines from nearly every module called by the manifest in my error log.  
I'll post a portion of it sanitized here; if there's a desire to see more 
contact me and I'll post the whole lot:


puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996434f48> - Lost it on 
/var/www/mte/SIGNUP/adv/design
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996432338> - Lost it on httpd
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b099642e558> - Lost it on sysklogd
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996430a10> - Lost it on vixie-cron
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b099642d4f0> - Lost it on rpm
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b099642c488> - Lost it on 
/var/www/mte/STATIC/design
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b099642aca0> - Lost it on var_machdb
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996429af8> - Lost it on nfs-utils
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b099636d150> - Lost it on postmap
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996428388> - Lost it on 
/var/www/mte/SIGNUP/adv/design
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b09964268f8> - Lost it on httpd
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996422d98> - Lost it on /var/www/cgi-bin
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996423e00> - Lost it on httpd
puppet-master[10279]: undefined method `to_hash' for 
#<Puppet::Resource::Reference:0x2b0996420f48> - Lost it on httpd

I'm worried that my assumption about returning false is not valid, and also 
worried that a critical comparison is getting lost somewhere...this one looks 
worrisome.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to