Issue #5428 has been updated by Daniel Pittman.

Subject changed from Catalog compile fails citing to_hash error to Catalog 
compile fails with to_hash error due to YAML object recovery in storeconfigs 
between 0.25 and 2.6 clients.
Assignee set to Daniel Pittman

The root cause of this problem, as notes, is that we have stored an obsolete 
version of an object; a quirk of YAML recovery, and our choice to store in the 
database using YAML, means that we can have objects that contain incomplete 
data in "impossible" ways as far as code inspection goes.  Sadly, the Ruby YAML 
libraries do not offer good hooks to improve on this situation, reliably across 
versions.

We are undertaking further internal testing to verify that the solution is 
correct in all cases, but are making positive progress on resolving the issue.
----------------------------------------
Bug #5428: Catalog compile fails with to_hash error due to YAML object recovery 
in storeconfigs between 0.25 and 2.6 clients.
https://projects.puppetlabs.com/issues/5428

Author: Eric Shamow
Status: Ready for Testing
Priority: Urgent
Assignee: Daniel Pittman
Category: plumbing
Target version: 2.6.6
Affected Puppet version: 2.6.3
Keywords: 
Branch: 
https://github.com/jhelwig/puppet/tree/ticket/2.6.next/5428-handle-0.25.x-storedconfig-data


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:
<pre>
Could not retrieve catalog from remote server: Error 400 on SERVER: undefined 
method `to_hash' for #<Puppet::Resource::Reference:0x2b38ce4140d8>
</pre>
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:
<pre>
       return false unless to_hash == other.to_hash
</pre>

Running with this, I wrapped that line in a rescue block:
<pre>
    begin
       return false unless to_hash == other.to_hash
    rescue => e
       Puppet.notice "#{e} - Lost it on #{other.title}"
       return false
    end
</pre>
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:

<pre>
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
</pre>
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