summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef_zero/data_store/v1_to_v2_adapter.rb7
-rw-r--r--lib/chef_zero/rest_request.rb4
-rw-r--r--lib/chef_zero/server.rb4
3 files changed, 6 insertions, 9 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
diff --git a/lib/chef_zero/server.rb b/lib/chef_zero/server.rb
index 16c6fc8..dc6e6a3 100644
--- a/lib/chef_zero/server.rb
+++ b/lib/chef_zero/server.rb
@@ -300,8 +300,8 @@ module ChefZero
#
def stop(wait = 5)
if @running
- @server.shutdown
- @thread.join(wait)
+ @server.shutdown if @server
+ @thread.join(wait) if @thread
end
rescue Timeout::Error
if @thread