From 31456f5b12e540d504c981fc9cbe34bd9cb0788a Mon Sep 17 00:00:00 2001 From: AJ Christensen Date: Wed, 9 Sep 2009 02:06:26 +1200 Subject: CHEF-546: Slight refactor of couchdb version comp Jan recommended that we only have a specific case for 0.8, as everything higher than that uses the new standardised format. Also, we're not using SHOW or LIST API's from CouchDB so no need to worry about 0.10 or 0.11 breakages. --- chef/lib/chef/couchdb.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/chef/lib/chef/couchdb.rb b/chef/lib/chef/couchdb.rb index 2ec2175c26..caae577280 100644 --- a/chef/lib/chef/couchdb.rb +++ b/chef/lib/chef/couchdb.rb @@ -153,12 +153,16 @@ class Chef end def view_uri(design, view) - Chef::Config[:couchdb_version] ||= @rest.run_request(:GET, URI.parse(@rest.url + "/"), false, 10, false)["version"].gsub(/-.+/,"").to_f + Chef::Config[:couchdb_version] ||= @rest.run_request(:GET, + URI.parse(@rest.url + "/"), + false, + 10, + false)["version"].gsub(/-.+/,"").to_f case Chef::Config[:couchdb_version] - when 0.9, 0.10 - "#{Chef::Config[:couchdb_database]}/_design/#{design}/_view/#{view}" when 0.8 "#{Chef::Config[:couchdb_database]}/_view/#{design}/#{view}" + else + "#{Chef::Config[:couchdb_database]}/_design/#{design}/_view/#{view}" end end -- cgit v1.2.1