From 10ea5e7e33a387eccddca32ea690a517f102eb6d Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Wed, 11 Feb 2015 16:02:05 -0800 Subject: STASH - debug output, has one fix for unknown const --- lib/chef_zero/data_store/raw_file_store.rb | 6 ++++-- lib/chef_zero/rest_base.rb | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/chef_zero/data_store/raw_file_store.rb b/lib/chef_zero/data_store/raw_file_store.rb index dce6374..6da7dd9 100644 --- a/lib/chef_zero/data_store/raw_file_store.rb +++ b/lib/chef_zero/data_store/raw_file_store.rb @@ -44,18 +44,20 @@ module ChefZero if destructible Dir.entries(root).each do |entry| next if entry == '.' || entry == '..' - FileUtils.rm_rf(Path.join(root, entry)) + FileUtils.rm_rf(File.join(root, entry)) end end end def create_dir(path, name, *options) + pp create_dir: {path: path, name: name} real_path = path_to(path, name) + pp create_dir_real_path: real_path if options.include?(:recursive) FileUtils.mkdir_p(real_path) else begin - Dir.mkdir(File.join(path, name)) + Dir.mkdir(real_path) rescue Errno::ENOENT raise DataNotFoundError.new(path) rescue Errno::EEXIST diff --git a/lib/chef_zero/rest_base.rb b/lib/chef_zero/rest_base.rb index 3fa017a..ec43f5e 100644 --- a/lib/chef_zero/rest_base.rb +++ b/lib/chef_zero/rest_base.rb @@ -116,10 +116,12 @@ module ChefZero rest_path ||= request.rest_path begin data_store.set(rest_path, data, *options, :requestor => request.requestor) - rescue DataStore::DataNotFoundError + rescue DataStore::DataNotFoundError => e if options.include?(:data_store_exceptions) raise else + puts e + puts e.backtrace raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}") end end -- cgit v1.2.1