Issue #22471 has been updated by Andrew Parker. Status changed from Accepted to In Topic Branch Pending Review Branch set to https://github.com/puppetlabs/puppet/pull/1894
<https://github.com/puppetlabs/puppet/pull/1894> ---------------------------------------- Bug #22471: Malformed state.yaml causes puppet to fail runs with Psych yaml parser https://projects.puppetlabs.com/issues/22471#change-97470 * Author: Matthaus Owens * Status: In Topic Branch Pending Review * Priority: Normal * Assignee: * Category: * Target version: 3.3.1 * Affected Puppet version: 3.0.0 * Keywords: * Branch: https://github.com/puppetlabs/puppet/pull/1894 ---------------------------------------- state.yaml can be invalid for a number of reasons, and when it cannot be correctly loaded Puppet tries to rescue the error. This works in Syck (default in ruby 1.8), but fails in ruby 1.9 with Psych because the loaderror is raised as a Psych::SyntaxError which is a subclass of SyntaxError. A blind rescue won't catch a SyntaxError, so Puppet needs to also rescue Psych::SyntaxError to gracefully handle an invalid state.yaml file. A puppet apply run after deliberately invalidating state.yaml: <pre> [root@el5-64 ~]# puppet apply --exec 'notify {"hello":}' Notice: Compiled catalog for el5-64.localdomain in environment production in 0.04 seconds Error: Could not run: (<unknown>): could not find expected ':' while scanning a simple key at line 4 column 3 </pre> We use the following bit of code in lib/puppet/indirector/yaml.rb that would help alleviate this problem. <pre> 4 class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus 5 if defined?(::Psych::SyntaxError) 6 YamlLoadExceptions = [::StandardError, ::ArgumentError, ::Psych::SyntaxError] 7 else 8 YamlLoadExceptions = [::StandardError, ::ArgumentError] 9 end </pre> -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
