summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/http/api
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-03-19 23:58:19 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-03-20 18:27:08 +1100
commit0179e945a7d402c90a333c8207243882af362e06 (patch)
treee977d49f50c7907a67799bd8d445f833f9c823ee /lib/puppet/network/http/api
parenta497263d97229489dcc4341cc98ca3c75f116374 (diff)
downloadpuppet-0179e945a7d402c90a333c8207243882af362e06.tar.gz
puppet-0179e945a7d402c90a333c8207243882af362e06.tar.xz
puppet-0179e945a7d402c90a333c8207243882af362e06.zip
Fixing #1557 - Environments are now in REST URIs
This commit includes multiple, related changes, all in one commit because the whole thing was necessary to reach a functional tree again: * The URI starts with the environment, so: /production/certificate/foo /development/file_content/path/to/your/file * All REST handling is done by a single instance mounted at / for webrick and Mongrel, rather than having individual instances mounted at, say, /certificate. * All REST URI translation is done by an API module. Currently only the 'v1' module exists with no support for additional modules, but it's well-separated and will be easy to expand as we need it. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/network/http/api')
-rw-r--r--lib/puppet/network/http/api/v1.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb
index 2ee1a815f..13df7c3d0 100644
--- a/lib/puppet/network/http/api/v1.rb
+++ b/lib/puppet/network/http/api/v1.rb
@@ -51,7 +51,12 @@ module Puppet::Network::HTTP::API::V1
end
def plurality(indirection)
- result = (indirection == handler.to_s + "s") ? :plural : :singular
+ # NOTE This specific hook for facts is ridiculous, but it's a *many*-line
+ # fix to not need this, and our goal is to move away from the complication
+ # that leads to the fix being too long.
+ return :singular if indirection == "facts"
+
+ result = (indirection =~ /s$/) ? :plural : :singular
indirection.sub!(/s$/, '') if result