From ca56aa7e5849a5489e8d38e29b25ea934caafcd7 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Mon, 26 Oct 2009 23:09:07 -0700 Subject: Least kludgy patch for #2675 This makes parameters responsible for the canonicalization of their values and provides a default (passthrough) implementation. It changes munge to pre- canonicalize the value and resource references to builtin types to canonicalize titles (which map to resorce namevars) with the corresponding parameter's classes's canonicalization. It adds a canonicalization routine to file paths that normalizes the behaviour (trailing slashes are ignored) and DRYs up the related code. Signed-off-by: Markus Roberts --- spec/unit/parser/resource/reference.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'spec/unit/parser/resource/reference.rb') diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb index 6284e67cc..a703f9284 100755 --- a/spec/unit/parser/resource/reference.rb +++ b/spec/unit/parser/resource/reference.rb @@ -40,10 +40,15 @@ describe Puppet::Parser::Resource::Reference do ref.to_s.should == "File[/tmp/yay]" end - it "should canonize resource references" do + it "should canonize resource reference types" do ref = @type.new(:type => "foo::bar", :title => "/tmp/yay") ref.to_s.should == "Foo::Bar[/tmp/yay]" end + + it "should canonize resource reference values" do + ref = @type.new(:type => "file", :title => "/tmp/yay/") + ref.to_s.should == "File[/tmp/yay]" + end end describe Puppet::Parser::Resource::Reference, " when modeling defined types" do -- cgit