Issue #2299 has been updated by Kurt Keller.

For us this started happening in 0.24.8 as well, since we added more clients. I 
don't have a fix for the root cause (corrupted YAML file), but the following 
patch against <code>puppet/indirector/yaml.rb</code> helps us a lot. Instead of 
puppet not running any more and an admin removing the offending YAML file, this 
is now done automatically with this patch.

<pre>
--- yaml.rb.ori 2010-03-02 16:04:57.000000000 +0000
+++ yaml.rb.new 2010-11-09 16:48:30.000000000 +0000
@@ -17,9 +17,13 @@
             raise Puppet::Error, "Could not read YAML data for %s %s: %s" % 
[indirection.name, request.key, detail]
         end
         begin
-            return from_yaml(yaml)
+            # give errors a chance to be caught before anything is returned
+            yaml_hack = from_yaml(yaml)
+            # and return the result if no errors are found
+            return yaml_hack
         rescue => detail
-            raise Puppet::Error, "Could not parse YAML data for %s %s: %s" % 
[indirection.name, request.key, detail]
+            # simply remove the trashed YAML file; it will be recreated
+            File.unlink(file)
         end
     end
</pre>
----------------------------------------
Bug #2299: Node YAML files being corrupted on puppet master server
https://projects.puppetlabs.com/issues/2299

Author: Greg Boug
Status: Duplicate
Priority: Normal
Assignee: Luke Kanies
Category: transactions
Target version: 
Affected Puppet version: 0.24.8
Keywords: 
Branch: 


There appears to be a case where the node YAML file for a given host gets 
corrupted. 

Error messages start appearing in the messages file of the client like these: 
<pre>
May 25 08:24:32 s_lo...@client puppetd[29059]: [ID 702911 daemon.error] 
(//Node[default]/filesecurity/File[/etc/default/passwd]) Failed to retrieve 
current state of resource: Could not parse YAML data for node 
CLIENT.domain.com: syntax error on line 46, col 18: `  operatingsystem: 
Solaris' Could not describe /filesecurity/passwd-CLIENT: Could not parse YAML 
data for node CLIENT.domain.com: syntax error on line 46, col 18: `  
operatingsystem: Solaris' at 
/etc//opt/csw/puppet/modules/filesecurity/manifests/init.pp:12
</pre>
This issue was *possibly* triggered by circumstances outside the control of the 
Puppet Master (like a network failure), but its the way Puppet handles this 
issue that I'm more concerned about... 

I have seen this happen a few times under different circumstances - usually the 
corruption is just an entry split across two lines - not a huge corruption. The 
solution I have used is to remove the file which causes Puppet to rebuild it 
from the client the next time it is triggered. 

What would be better would be to detect the failure and attempt to rebuild 
first before alerting. Obviously it would be better to not have the corruption 
in the first place, but given the existance of custom facts and other 
code-based add-ons, this is unlikely to be something that Puppet can stop from 
happening. Would also be preferable to have it retry a set number of times - 
otherwise it could in theory get into an infinate loop... 


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