summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2014-09-03 15:34:23 -0700
committerJohn Keiser <jkeiser@opscode.com>2014-09-03 15:53:35 -0700
commit3d2c4b754a2f3c4bc00df013766bcccab6a91762 (patch)
tree811634e14117ac107506b9f581ebc3bbed5ea4c0 /lib
parentfd83ac07713dc7724abcda6fa1f6912c9af5943b (diff)
downloadchef-zero-3d2c4b754a2f3c4bc00df013766bcccab6a91762.tar.gz
Pass base URI to V1 data store only in true single org modebase_uri
Diffstat (limited to 'lib')
-rw-r--r--lib/chef_zero/data_store/v1_to_v2_adapter.rb7
-rw-r--r--lib/chef_zero/rest_request.rb4
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/chef_zero/data_store/v1_to_v2_adapter.rb b/lib/chef_zero/data_store/v1_to_v2_adapter.rb
index 31195f8..576f27d 100644
--- a/lib/chef_zero/data_store/v1_to_v2_adapter.rb
+++ b/lib/chef_zero/data_store/v1_to_v2_adapter.rb
@@ -38,14 +38,15 @@ module ChefZero
def get(path, request=nil)
raise DataNotFoundError.new(path) if skip_organizations?(path)
fix_exceptions do
- if request
+ # Make it so build_uri will include /organizations/ORG inside the V1 data store
+ if request && request.rest_base_prefix.size == 0
old_base_uri = request.base_uri
- request.base_uri = File.join(request.base_uri, path[0..1])
+ request.base_uri = File.join(request.base_uri, 'organizations', single_org)
end
begin
real_store.get(path[2..-1], request)
ensure
- request.base_uri = old_base_uri if request
+ request.base_uri = old_base_uri if request && request.rest_base_prefix.size == 0
end
end
end
diff --git a/lib/chef_zero/rest_request.rb b/lib/chef_zero/rest_request.rb
index 3ae523d..e79af7f 100644
--- a/lib/chef_zero/rest_request.rb
+++ b/lib/chef_zero/rest_request.rb
@@ -18,10 +18,6 @@ module ChefZero
@base_uri = value
end
- def build_uri(*relative)
- File.join(@base_uri, *rest_base_prefix, *relative)
- end
-
def requestor
@env['HTTP_X_OPS_USERID']
end