Greetings!
Please review the pull request #125: Fix #7004 - various indirection with trailing 'e' have a broken plural opened by (masterzen)
Some more information about the pull request:
- Opened: Sun Sep 18 13:30:04 UTC 2011
- Based on: puppetlabs:2.7.x (18afb3a5262b1447c6bb2f21e5ecb3262d004777)
- Requested merge: masterzen:tickets/2.7.x/7004 (f74dc283998d5f442729f3e5a7819ef2e8146f6e)
Description:
This is not a complete fix.
This got broken when the status indirection was added around
d1f1858.
The problem is that the regex matching is greedy so any indirection
ending in e (and pluralized in 'es') will lose its trailing 'e'.
Since all this was done for the status indirection, my fix is to
treat differently this indirection only, instead of trying to fix
the general case (and breaking it).
Signed-off-by: Brice Figureau [email protected]
Thanks!
The Pull Request Bot
Diff follows:
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb
index 388d549..852568a 100644
--- a/lib/puppet/network/http/api/v1.rb
+++ b/lib/puppet/network/http/api/v1.rb
@@ -74,7 +74,8 @@ module Puppet::Network::HTTP::API::V1
result = (indirection =~ /s$|_search$/) ? :plural : :singular
- indirection.sub!(/s$|_search$|es$/, '')
+ indirection.sub!(/s$|_search$/, '')
+ indirection.sub!(/statuse$/, 'status')
result
end
diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb
index a952f24..039bccf 100755
--- a/spec/unit/network/http/api/v1_spec.rb
+++ b/spec/unit/network/http/api/v1_spec.rb
@@ -123,6 +123,10 @@ describe Puppet::Network::HTTP::API::V1 do
@tester.uri2indirection("GET", "/env/statuses/bar", {})[0].should == 'status'
end
+ it "should change indirection name to 'probe' if the http method is a GET and the indirection name is probes" do
+ @tester.uri2indirection("GET", "/env/probes/bar", {})[0].should == 'probe'
+ end
+
it "should choose 'delete' as the indirection method if the http method is a DELETE and the indirection name is singular" do
@tester.uri2indirection("DELETE", "/env/foo/bar", {})[1].should == :destroy
end
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
