9 I spent way too long the other day thrying to figure out why some Hiera variable wasn't available in some puppet manifest.
11 It turns out there was a typo in the YAML file where the first line of the file only had two dashes instead of three.
13 In this cases, the Ruby 1.8.7 yaml parser corrupts the first entry in the yaml file, adding the two dashes to the beginning of the key, instead of throwing a parser error.
17 irb(main):001:0> require 'yaml'
19 irb(main):002:0> a=YAML.load_file("only-two-dashes.yaml")
20 => {"-- first"=>1, "second"=>2}
21 irb(main):003:0> b=YAML.load_file("correctly-including-three-dashes.yaml")
22 => {"first"=>2, "first"=>1}
24 I couldn't find an existing bug for this, but I didn't look to harrd since this has been fixed in Ruby 1.9
28 irb(main):001:0> require 'yaml'
30 irb(main):002:0> a=YAML.load_file("only-two-dashes.yaml")
31 Psych::SyntaxError: (t1.yaml): couldn't parse YAML at line 1 column 1
32 from /usr/lib/ruby/1.9.1/psych.rb:154:in `parse'
33 from /usr/lib/ruby/1.9.1/psych.rb:154:in `parse_stream'
34 from /usr/lib/ruby/1.9.1/psych.rb:125:in `parse'
35 from /usr/lib/ruby/1.9.1/psych.rb:112:in `load'
36 from /usr/lib/ruby/1.9.1/psych.rb:229:in `load_file'
38 from /usr/bin/irb1.9.1:12:in `<main>'.
40 So if you're using Ruby 1.8.7, and it looks like the first item in your YAML file is being dropped for some
41 reason, check the first line of the file has 3 dashes.