summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
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