summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-04-11 18:44:11 +0100
committerThom May <thom@chef.io>2016-04-13 10:07:08 +0100
commite6c9c3a03d7b770bcf8f7786617b6644d24a6b8a (patch)
tree67b4bf62d6f040f93ab62eb641c123558c82cc0c
parente7d602b1225041b5f2815dab235bba901dd8d341 (diff)
downloadchef-e6c9c3a03d7b770bcf8f7786617b6644d24a6b8a.tar.gz
Move all ChefFS exceptions into a single filetm/combined_chef_fs_exceptions
This leaves back compat requires to ensure nothing breaks.
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb2
-rw-r--r--lib/chef/chef_fs/command_line.rb3
-rw-r--r--lib/chef/chef_fs/file_system.rb4
-rw-r--r--lib/chef/chef_fs/file_system/already_exists_error.rb12
-rw-r--r--lib/chef/chef_fs/file_system/base_fs_object.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_entry.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb3
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb3
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/environments_dir.rb3
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb3
-rw-r--r--lib/chef/chef_fs/file_system/cookbook_frozen_error.rb12
-rw-r--r--lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb16
-rw-r--r--lib/chef/chef_fs/file_system/exceptions.rb98
-rw-r--r--lib/chef/chef_fs/file_system/file_system_error.rb28
-rw-r--r--lib/chef/chef_fs/file_system/must_delete_recursively_error.rb12
-rw-r--r--lib/chef/chef_fs/file_system/nonexistent_fs_object.rb2
-rw-r--r--lib/chef/chef_fs/file_system/not_found_error.rb12
-rw-r--r--lib/chef/chef_fs/file_system/operation_failed_error.rb26
-rw-r--r--lib/chef/chef_fs/file_system/operation_not_allowed_error.rb30
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/directory.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/file_system_entry.rb4
-rw-r--r--lib/chef/knife/show.rb2
31 files changed, 136 insertions, 167 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 6b6364e2e3..aa5a6d5a69 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -22,7 +22,7 @@ require "chef_zero/data_store/data_already_exists_error"
require "chef_zero/data_store/data_not_found_error"
require "chef/chef_fs/file_pattern"
require "chef/chef_fs/file_system"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/chef_fs/file_system/memory/memory_root"
require "fileutils"
diff --git a/lib/chef/chef_fs/command_line.rb b/lib/chef/chef_fs/command_line.rb
index f3e63286f2..4a9a712c20 100644
--- a/lib/chef/chef_fs/command_line.rb
+++ b/lib/chef/chef_fs/command_line.rb
@@ -17,8 +17,7 @@
#
require "chef/chef_fs/file_system"
-require "chef/chef_fs/file_system/operation_failed_error"
-require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/util/diff"
class Chef
diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb
index e6cf735971..2b553b19a7 100644
--- a/lib/chef/chef_fs/file_system.rb
+++ b/lib/chef/chef_fs/file_system.rb
@@ -17,9 +17,7 @@
#
require "chef/chef_fs/path_utils"
-require "chef/chef_fs/file_system/default_environment_cannot_be_modified_error"
-require "chef/chef_fs/file_system/operation_failed_error"
-require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/chef_fs/parallelizer"
class Chef
diff --git a/lib/chef/chef_fs/file_system/already_exists_error.rb b/lib/chef/chef_fs/file_system/already_exists_error.rb
index 92ec915b5c..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/already_exists_error.rb
+++ b/lib/chef/chef_fs/file_system/already_exists_error.rb
@@ -16,13 +16,5 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/operation_failed_error"
-
-class Chef
- module ChefFS
- module FileSystem
- class AlreadyExistsError < OperationFailedError
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/base_fs_object.rb b/lib/chef/chef_fs/file_system/base_fs_object.rb
index cf1aed552f..6abbcf343f 100644
--- a/lib/chef/chef_fs/file_system/base_fs_object.rb
+++ b/lib/chef/chef_fs/file_system/base_fs_object.rb
@@ -17,7 +17,7 @@
#
require "chef/chef_fs/path_utils"
-require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb b/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
index 58a32d3860..9f4d13f5a9 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
@@ -18,7 +18,7 @@
require "chef/chef_fs/file_system/base_fs_dir"
require "chef/chef_fs/file_system/chef_server/acl_entry"
-require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
index cf634256bb..68df3704bf 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
@@ -17,9 +17,7 @@
#
require "chef/chef_fs/file_system/chef_server/rest_list_entry"
-require "chef/chef_fs/file_system/not_found_error"
-require "chef/chef_fs/file_system/operation_not_allowed_error"
-require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
index f7e5f058be..3fa5b49eb1 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
@@ -20,7 +20,7 @@ require "chef/chef_fs/command_line"
require "chef/chef_fs/file_system/chef_server/rest_list_dir"
require "chef/chef_fs/file_system/chef_server/cookbook_subdir"
require "chef/chef_fs/file_system/chef_server/cookbook_file"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/cookbook_version"
require "chef/cookbook_uploader"
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
index 72cefe44eb..631562d7ef 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
@@ -18,8 +18,7 @@
require "chef/chef_fs/file_system/chef_server/rest_list_dir"
require "chef/chef_fs/file_system/chef_server/cookbook_dir"
-require "chef/chef_fs/file_system/operation_failed_error"
-require "chef/chef_fs/file_system/cookbook_frozen_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
require "chef/mixin/file_class"
diff --git a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
index 6b06550a0a..5ad0063807 100644
--- a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
@@ -17,8 +17,7 @@
#
require "chef/chef_fs/file_system/chef_server/rest_list_dir"
-require "chef/chef_fs/file_system/not_found_error"
-require "chef/chef_fs/file_system/must_delete_recursively_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/chef_fs/data_handler/data_bag_item_data_handler"
class Chef
diff --git a/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb b/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
index 494036931f..81ae81ac0d 100644
--- a/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
@@ -18,8 +18,7 @@
require "chef/chef_fs/file_system/base_fs_dir"
require "chef/chef_fs/file_system/chef_server/rest_list_entry"
-require "chef/chef_fs/file_system/not_found_error"
-require "chef/chef_fs/file_system/default_environment_cannot_be_modified_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
index 6ecc7f4336..4f83b89711 100644
--- a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
@@ -18,7 +18,7 @@
require "chef/chef_fs/file_system/base_fs_dir"
require "chef/chef_fs/file_system/chef_server/rest_list_entry"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/chef_fs/data_handler/node_data_handler"
class Chef
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
index 98a0463069..b7413c44c5 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
@@ -16,9 +16,7 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/already_exists_error"
-require "chef/chef_fs/file_system/not_found_error"
-require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb b/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
index 7243996cbb..0452fa4573 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
@@ -18,7 +18,7 @@
require "chef/chef_fs/file_system/base_fs_dir"
require "chef/chef_fs/file_system/chef_server/rest_list_entry"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/chef_fs/file_system/chef_server/policy_group_entry"
class Chef
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
index b5b602a208..276f7760b5 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
@@ -18,7 +18,7 @@
require "chef/chef_fs/file_system/base_fs_dir"
require "chef/chef_fs/file_system/chef_server/rest_list_entry"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
index 5b9252ba03..9b16bd80de 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
@@ -17,8 +17,7 @@
#
require "chef/chef_fs/file_system/base_fs_object"
-require "chef/chef_fs/file_system/not_found_error"
-require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/role"
require "chef/node"
require "chef/json_compat"
diff --git a/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb b/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
index 20ac6f1eda..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
+++ b/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
@@ -16,13 +16,5 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/already_exists_error"
-
-class Chef
- module ChefFS
- module FileSystem
- class CookbookFrozenError < AlreadyExistsError
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb b/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
index e55f97d85c..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
+++ b/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
@@ -16,17 +16,5 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/operation_not_allowed_error"
-
-class Chef
- module ChefFS
- module FileSystem
- class DefaultEnvironmentCannotBeModifiedError < OperationNotAllowedError
- def reason
- result = super
- result + " (default environment cannot be modified)"
- end
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/exceptions.rb b/lib/chef/chef_fs/file_system/exceptions.rb
new file mode 100644
index 0000000000..cf4916e4c8
--- /dev/null
+++ b/lib/chef/chef_fs/file_system/exceptions.rb
@@ -0,0 +1,98 @@
+#
+# Author:: Thom May (<thom@chef.io>)
+# Copyright:: Copyright 2012-2016, Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+class Chef
+ module ChefFS
+ module FileSystem
+ class FileSystemError < StandardError
+ # @param entry The entry which had an issue.
+ # @param cause The wrapped exception (if any).
+ # @param reason A string describing why this exception happened.
+ def initialize(entry, cause = nil, reason = nil)
+ super(reason)
+ @entry = entry
+ @cause = cause
+ @reason = reason
+ end
+
+ # The entry which had an issue.
+ attr_reader :entry
+
+ # The wrapped exception (if any).
+ attr_reader :cause
+
+ # A string describing why this exception happened.
+ attr_reader :reason
+ end
+
+ class MustDeleteRecursivelyError < FileSystemError; end
+
+ class NotFoundError < FileSystemError; end
+
+ class OperationFailedError < FileSystemError
+ def initialize(operation, entry, cause = nil, reason = nil)
+ super(entry, cause, reason)
+ @operation = operation
+ end
+
+ def message
+ if cause && cause.is_a?(Net::HTTPExceptions) && cause.response.code == "400"
+ "#{super} cause: #{cause.response.body}"
+ else
+ super
+ end
+ end
+
+ attr_reader :operation
+ end
+
+ class OperationNotAllowedError < FileSystemError
+ def initialize(operation, entry, cause = nil, reason = nil)
+ reason ||=
+ case operation
+ when :delete
+ "cannot be deleted"
+ when :write
+ "cannot be updated"
+ when :create_child
+ "cannot have a child created under it"
+ when :read
+ "cannot be read"
+ end
+ super(entry, cause, reason)
+ @operation = operation
+ end
+
+ attr_reader :operation
+ attr_reader :entry
+ end
+
+ class AlreadyExistsError < OperationFailedError; end
+
+ class CookbookFrozenError < AlreadyExistsError; end
+
+ class DefaultEnvironmentCannotBeModifiedError < OperationNotAllowedError
+ def reason
+ result = super
+ result + " (default environment cannot be modified)"
+ end
+ end
+
+ end
+ end
+end
diff --git a/lib/chef/chef_fs/file_system/file_system_error.rb b/lib/chef/chef_fs/file_system/file_system_error.rb
index 1a2a19d286..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/file_system_error.rb
+++ b/lib/chef/chef_fs/file_system/file_system_error.rb
@@ -16,29 +16,5 @@
# limitations under the License.
#
-class Chef
- module ChefFS
- module FileSystem
- class FileSystemError < StandardError
- # @param entry The entry which had an issue.
- # @param cause The wrapped exception (if any).
- # @param reason A string describing why this exception happened.
- def initialize(entry, cause = nil, reason = nil)
- super(reason)
- @entry = entry
- @cause = cause
- @reason = reason
- end
-
- # The entry which had an issue.
- attr_reader :entry
-
- # The wrapped exception (if any).
- attr_reader :cause
-
- # A string describing why this exception happened.
- attr_reader :reason
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb b/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
index 5f538d8877..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
+++ b/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
@@ -16,13 +16,5 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/file_system_error"
-
-class Chef
- module ChefFS
- module FileSystem
- class MustDeleteRecursivelyError < FileSystemError
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb b/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
index 81c0154d68..b78dcb6c0b 100644
--- a/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
+++ b/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
@@ -17,7 +17,7 @@
#
require "chef/chef_fs/file_system/base_fs_object"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/not_found_error.rb b/lib/chef/chef_fs/file_system/not_found_error.rb
index a7f66d7875..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/not_found_error.rb
+++ b/lib/chef/chef_fs/file_system/not_found_error.rb
@@ -16,13 +16,5 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/file_system_error"
-
-class Chef
- module ChefFS
- module FileSystem
- class NotFoundError < FileSystemError
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/operation_failed_error.rb b/lib/chef/chef_fs/file_system/operation_failed_error.rb
index faf19c7dad..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/operation_failed_error.rb
+++ b/lib/chef/chef_fs/file_system/operation_failed_error.rb
@@ -16,27 +16,5 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/file_system_error"
-
-class Chef
- module ChefFS
- module FileSystem
- class OperationFailedError < FileSystemError
- def initialize(operation, entry, cause = nil, reason = nil)
- super(entry, cause, reason)
- @operation = operation
- end
-
- def message
- if cause && cause.is_a?(Net::HTTPExceptions) && cause.response.code == "400"
- "#{super} cause: #{cause.response.body}"
- else
- super
- end
- end
-
- attr_reader :operation
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb b/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
index ab93bc9f13..6d9973e8a4 100644
--- a/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
+++ b/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
@@ -16,31 +16,5 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/file_system_error"
-
-class Chef
- module ChefFS
- module FileSystem
- class OperationNotAllowedError < FileSystemError
- def initialize(operation, entry, cause = nil, reason = nil)
- reason ||=
- case operation
- when :delete
- "cannot be deleted"
- when :write
- "cannot be updated"
- when :create_child
- "cannot have a child created under it"
- when :read
- "cannot be read"
- end
- super(entry, cause, reason)
- @operation = operation
- end
-
- attr_reader :operation
- attr_reader :entry
- end
- end
- end
-end
+require "chef/chef_fs/file_system/exceptions"
+Chef.log_deprecation "Individual ChefFS error files are deprecated. Please require 'chef/chef_fs/file_system/exceptions' rather than 'chef/chef_fs/file_system/#{File.basename(__FILE__, ".rb")}'."
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
index 6a30bdf33f..1b640bc076 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
@@ -19,7 +19,7 @@
require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry"
require "chef/chef_fs/file_system/chef_server/cookbook_dir"
require "chef/chef_fs/file_system/chef_server/versioned_cookbook_dir"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/cookbook/cookbook_version_loader"
class Chef
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
index 5935336153..f533aa1080 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
@@ -18,7 +18,7 @@
require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
require "chef/chef_fs/file_system/repository/cookbooks_dir"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
index 329e2e3509..b9d681c116 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
@@ -18,7 +18,7 @@
#
require "chef/chef_fs/file_system/repository/file_system_entry"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/directory.rb b/lib/chef/chef_fs/file_system/repository/directory.rb
index 898f3847c4..782a134a58 100644
--- a/lib/chef/chef_fs/file_system/repository/directory.rb
+++ b/lib/chef/chef_fs/file_system/repository/directory.rb
@@ -54,7 +54,7 @@ class Chef
possible_child.dir? == is_dir && possible_child.name_valid?
end
- # Public API callied by chef_fs/file_system
+ # Public API called by chef_fs/file_system
def dir?
true
end
diff --git a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
index bee017f7a8..20e2eb7efc 100644
--- a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
@@ -18,9 +18,7 @@
require "chef/chef_fs/file_system/base_fs_dir"
require "chef/chef_fs/file_system/chef_server/rest_list_dir"
-require "chef/chef_fs/file_system/already_exists_error"
-require "chef/chef_fs/file_system/must_delete_recursively_error"
-require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/exceptions"
require "chef/chef_fs/path_utils"
require "fileutils"
diff --git a/lib/chef/knife/show.rb b/lib/chef/knife/show.rb
index 88a192994e..4c1c882815 100644
--- a/lib/chef/knife/show.rb
+++ b/lib/chef/knife/show.rb
@@ -9,7 +9,7 @@ class Chef
deps do
require "chef/chef_fs/file_system"
- require "chef/chef_fs/file_system/not_found_error"
+ require "chef/chef_fs/file_system/exceptions"
end
option :local,