diff options
| author | Luke Kanies <luke@madstop.com> | 2009-02-14 17:50:19 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-18 22:38:43 -0600 |
| commit | 5fd182dc1ce1e5e8dd0eba83d7514e9950aca8a0 (patch) | |
| tree | 3b65b5796d2a9cf6967ba9f0e5148c313bed3dc1 | |
| parent | 7bc41cefa0115067a2e9aab3dbd1924667c46dfe (diff) | |
| download | puppet-5fd182dc1ce1e5e8dd0eba83d7514e9950aca8a0.tar.gz puppet-5fd182dc1ce1e5e8dd0eba83d7514e9950aca8a0.tar.xz puppet-5fd182dc1ce1e5e8dd0eba83d7514e9950aca8a0.zip | |
Fixing fileserving to support strings or symbols
When used internally we would use symbols, but
the REST transfers need to support strings.
Signed-off-by: Luke Kanies <luke@madstop.com>
| -rw-r--r-- | lib/puppet/file_serving/base.rb | 1 | ||||
| -rw-r--r-- | lib/puppet/file_serving/fileset.rb | 2 | ||||
| -rwxr-xr-x | spec/integration/indirector/rest.rb | 8 | ||||
| -rwxr-xr-x | spec/unit/file_serving/base.rb | 4 |
4 files changed, 10 insertions, 5 deletions
diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb index 2a0199dee..d1fa9dfd2 100644 --- a/lib/puppet/file_serving/base.rb +++ b/lib/puppet/file_serving/base.rb @@ -46,6 +46,7 @@ class Puppet::FileServing::Base # Determine how we deal with links. attr_reader :links def links=(value) + value = value.to_sym value = :manage if value == :ignore raise(ArgumentError, ":links can only be set to :manage or :follow") unless [:manage, :follow].include?(value) @links = value diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb index b28fb2d7e..caad1b319 100644 --- a/lib/puppet/file_serving/fileset.rb +++ b/lib/puppet/file_serving/fileset.rb @@ -64,7 +64,7 @@ class Puppet::FileServing::Fileset end def links=(links) - links = links.intern if links.is_a?(String) + links = links.to_sym raise(ArgumentError, "Invalid :links value '%s'" % links) unless [:manage, :follow].include?(links) @links = links @stat_method = links == :manage ? :lstat : :stat diff --git a/spec/integration/indirector/rest.rb b/spec/integration/indirector/rest.rb index 1adbdac61..cfaaa5027 100755 --- a/spec/integration/indirector/rest.rb +++ b/spec/integration/indirector/rest.rb @@ -94,7 +94,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:find).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instance + @mock_model.expects(:find).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instance Puppet::TestIndirectedFoo.find('bar', :one => "two", :three => "four") end @@ -159,7 +159,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:search).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instances + @mock_model.expects(:search).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instances Puppet::TestIndirectedFoo.search("foo", :one => "two", :three => "four") end @@ -328,7 +328,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:find).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instance + @mock_model.expects(:find).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instance Puppet::TestIndirectedFoo.find('bar', :one => "two", :three => "four") end @@ -390,7 +390,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:search).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instances + @mock_model.expects(:search).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instances Puppet::TestIndirectedFoo.search('bar', :one => "two", :three => "four") end diff --git a/spec/unit/file_serving/base.rb b/spec/unit/file_serving/base.rb index 4eb62b038..de7ea4756 100755 --- a/spec/unit/file_serving/base.rb +++ b/spec/unit/file_serving/base.rb @@ -31,6 +31,10 @@ describe Puppet::FileServing::Base do proc { Puppet::FileServing::Base.new("/module/dir/file", :links => :else) }.should raise_error(ArgumentError) end + it "should allow links values to be set as strings" do + Puppet::FileServing::Base.new("/module/dir/file", :links => "follow").links.should == :follow + end + it "should default to :manage for :links" do Puppet::FileServing::Base.new("/module/dir/file").links.should == :manage end |
