From efe68165b382d6860e83b0bb1d1108f36fa3d2fd Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 7 Apr 2009 18:41:51 -0500 Subject: Removing unnecessary parser variables when yaml-dumping Also working around a YAML bug in Ruby. And fixing tests that were broken in a previous commit in this rebase but not caught earlier. Signed-off-by: Luke Kanies --- lib/puppet/parser/resource/param.rb | 4 +++- lib/puppet/parser/resource/reference.rb | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/puppet/parser/resource') diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb index 6e22d3e17..0f791ecc5 100644 --- a/lib/puppet/parser/resource/param.rb +++ b/lib/puppet/parser/resource/param.rb @@ -1,4 +1,5 @@ require 'puppet/file_collection/lookup' +require 'puppet/parser/yaml_trimmer' # The parameters we stick in Resources. class Puppet::Parser::Resource::Param @@ -8,6 +9,7 @@ class Puppet::Parser::Resource::Param include Puppet::Util::MethodHelper include Puppet::FileCollection::Lookup + include Puppet::Parser::YamlTrimmer def initialize(hash) set_options(hash) @@ -16,7 +18,7 @@ class Puppet::Parser::Resource::Param end def inspect - "#<#{self.class} @name => #{name}, @value => #{value}, @source => #{source.name}, @line => #{line}>" + "#<#{self.class} @name => #{name}, @value => #{value}, @source => #{source.name if source}, @line => #{line}>" end def line_to_i diff --git a/lib/puppet/parser/resource/reference.rb b/lib/puppet/parser/resource/reference.rb index 0c28cf0df..cacd0707e 100644 --- a/lib/puppet/parser/resource/reference.rb +++ b/lib/puppet/parser/resource/reference.rb @@ -1,9 +1,11 @@ # A reference to a resource. Mostly just the type and title. require 'puppet/resource/reference' require 'puppet/file_collection/lookup' +require 'puppet/parser/yaml_trimmer' # A reference to a resource. Mostly just the type and title. class Puppet::Parser::Resource::Reference < Puppet::Resource::Reference + include Puppet::Parser::YamlTrimmer include Puppet::FileCollection::Lookup include Puppet::Util::MethodHelper include Puppet::Util::Errors @@ -69,6 +71,10 @@ class Puppet::Parser::Resource::Reference < Puppet::Resource::Reference requiredopts(:type, :title) end + def skip_for_yaml + %w{@typeclass @definedtype} + end + def to_ref # We have to return different cases to provide backward compatibility # from 0.24.x to 0.23.x. -- cgit