diff options
author | Tim Smith <tsmith@chef.io> | 2019-12-29 18:06:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-29 18:06:37 -0800 |
commit | c8bf6efa66ff005ab87ff81c9a857ea0c6c1090e (patch) | |
tree | 3a25409c03ff3ac83f94e6e740145353d3e2c095 /lib/chef_zero/data_store/v1_to_v2_adapter.rb | |
parent | 435755ee68c14fd6d6f858e451e7afeee1610e6f (diff) | |
parent | ecad8fee4a946b337e60a4274de2b2c872c9e81b (diff) | |
download | chef-zero-c8bf6efa66ff005ab87ff81c9a857ea0c6c1090e.tar.gz |
Merge pull request #298 from chef/chefstyle
Apply Chefstyle
Diffstat (limited to 'lib/chef_zero/data_store/v1_to_v2_adapter.rb')
-rw-r--r-- | lib/chef_zero/data_store/v1_to_v2_adapter.rb | 10 |
1 files changed, 10 insertions, 0 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 874c05a..1840656 100644 --- a/lib/chef_zero/data_store/v1_to_v2_adapter.rb +++ b/lib/chef_zero/data_store/v1_to_v2_adapter.rb @@ -21,6 +21,7 @@ module ChefZero raise DataNotFoundError.new(path) if skip_organizations?(path) raise "Cannot create #{name} at #{path} with V1ToV2Adapter: only handles a single org named #{single_org}." if skip_organizations?(path, name) raise DataAlreadyExistsError.new(path + [ name ]) if path.size < 2 + fix_exceptions do real_store.create_dir(path[2..-1], name, *options) end @@ -30,6 +31,7 @@ module ChefZero raise DataNotFoundError.new(path) if skip_organizations?(path) raise "Cannot create #{name} at #{path} with V1ToV2Adapter: only handles a single org named #{single_org}." if skip_organizations?(path, name) raise DataAlreadyExistsError.new(path + [ name ]) if path.size < 2 + fix_exceptions do real_store.create(path[2..-1], name, data, *options) end @@ -37,6 +39,7 @@ module ChefZero def get(path, request = nil) raise DataNotFoundError.new(path) if skip_organizations?(path) + fix_exceptions do # Make it so build_uri will include /organizations/ORG inside the V1 data store if request && request.rest_base_prefix.size == 0 @@ -53,6 +56,7 @@ module ChefZero def set(path, data, *options) raise DataNotFoundError.new(path) if skip_organizations?(path) + fix_exceptions do real_store.set(path[2..-1], data, *options) end @@ -60,6 +64,7 @@ module ChefZero def delete(path, *options) raise DataNotFoundError.new(path) if skip_organizations?(path) && !options.include?(:recursive) + fix_exceptions do real_store.delete(path[2..-1]) end @@ -67,6 +72,7 @@ module ChefZero def delete_dir(path, *options) raise DataNotFoundError.new(path) if skip_organizations?(path) && !options.include?(:recursive) + fix_exceptions do real_store.delete_dir(path[2..-1], *options) end @@ -74,6 +80,7 @@ module ChefZero def list(path) raise DataNotFoundError.new(path) if skip_organizations?(path) + if path == [] [ "organizations" ] elsif path == [ "organizations" ] @@ -87,6 +94,7 @@ module ChefZero def exists?(path) return false if skip_organizations?(path) + fix_exceptions do real_store.exists?(path[2..-1]) end @@ -94,12 +102,14 @@ module ChefZero def exists_dir?(path) return false if skip_organizations?(path) + if path == [] true elsif path == [ "organizations" ] || path == [ "users" ] true else return false if skip_organizations?(path) + fix_exceptions do real_store.exists_dir?(path[2..-1]) end |