diff options
author | Steven Murawski <steven.murawski@gmail.com> | 2017-04-04 15:29:44 -0500 |
---|---|---|
committer | Steven Murawski <steven.murawski@gmail.com> | 2017-04-04 15:29:44 -0500 |
commit | d08cbdaad788da3b9b1658717353f939361b3add (patch) | |
tree | 2316dacebcf1dd8c5c92a227f25335d4a3812997 /lib | |
parent | 4b0926387418cd8d4105c125aebd23e68b612ff4 (diff) | |
download | chef-d08cbdaad788da3b9b1658717353f939361b3add.tar.gz |
removing the use of Chef::Exception::DeprecatedExitCodesmurawski/exit_status_default
Signed-off-by: Steven Murawski <steven.murawski@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/application/exit_code.rb | 10 | ||||
-rw-r--r-- | lib/chef/application/windows_service.rb | 6 | ||||
-rw-r--r-- | lib/chef/config_fetcher.rb | 8 | ||||
-rw-r--r-- | lib/chef/exceptions.rb | 6 |
4 files changed, 8 insertions, 22 deletions
diff --git a/lib/chef/application/exit_code.rb b/lib/chef/application/exit_code.rb index 246c95380b..917aa16e62 100644 --- a/lib/chef/application/exit_code.rb +++ b/lib/chef/application/exit_code.rb @@ -72,8 +72,6 @@ class Chef VALID_RFC_062_EXIT_CODES[:SIGINT_RECEIVED] elsif sigterm_received?(exception) VALID_RFC_062_EXIT_CODES[:SIGTERM_RECEIVED] - elsif legacy_exit_code?(exception) - VALID_RFC_062_EXIT_CODES[:GENERIC_FAILURE] elsif reboot_scheduled?(exception) VALID_RFC_062_EXIT_CODES[:REBOOT_SCHEDULED] elsif reboot_needed?(exception) @@ -89,12 +87,6 @@ class Chef end end - def legacy_exit_code?(exception) - resolve_exception_array(exception).any? do |e| - e.is_a? Chef::Exceptions::DeprecatedExitCode - end - end - def reboot_scheduled?(exception) resolve_exception_array(exception).any? do |e| e.is_a? Chef::Exceptions::Reboot @@ -162,7 +154,7 @@ class Chef "Chef attempted to exit with a non-standard exit code of #{exit_code}." \ " Chef RFC 062 (https://github.com/chef/chef-rfc/blob/master/rfc062-exit-status.md) defines the" \ " exit codes that should be used with Chef. Chef::Application::ExitCode defines valid exit codes" \ - " Non-standard exit codes are redefined as GENERIC_FAILURE." + " Non-standard exit codes are redefined as GENERIC_FAILURE." end end diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index 7bc68a586d..c30f5d1fe8 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -318,11 +318,11 @@ class Chef Chef::Config.merge!(config) rescue SocketError - Chef::Application.fatal!("Error getting config file #{Chef::Config[:config_file]}", Chef::Exceptions::DeprecatedExitCode.new) + Chef::Application.fatal!("Error getting config file #{Chef::Config[:config_file]}") rescue Chef::Exceptions::ConfigurationError => error - Chef::Application.fatal!("Error processing config file #{Chef::Config[:config_file]} with error #{error.message}", Chef::Exceptions::DeprecatedExitCode.new) + Chef::Application.fatal!("Error processing config file #{Chef::Config[:config_file]} with error #{error.message}") rescue Exception => error - Chef::Application.fatal!("Unknown error processing config file #{Chef::Config[:config_file]} with error #{error.message}", Chef::Exceptions::DeprecatedExitCode.new) + Chef::Application.fatal!("Unknown error processing config file #{Chef::Config[:config_file]} with error #{error.message}") end end diff --git a/lib/chef/config_fetcher.rb b/lib/chef/config_fetcher.rb index ee1b64956a..e14428157c 100644 --- a/lib/chef/config_fetcher.rb +++ b/lib/chef/config_fetcher.rb @@ -25,7 +25,7 @@ class Chef begin Chef::JSONCompat.from_json(config_data) rescue Chef::Exceptions::JSON::ParseError => error - Chef::Application.fatal!("Could not parse the provided JSON file (#{config_location}): " + error.message, Chef::Exceptions::DeprecatedExitCode.new) + Chef::Application.fatal!("Could not parse the provided JSON file (#{config_location}): " + error.message) end end @@ -40,15 +40,15 @@ class Chef def fetch_remote_config http.get("") rescue SocketError, SystemCallError, Net::HTTPServerException => error - Chef::Application.fatal!("Cannot fetch config '#{config_location}': '#{error.class}: #{error.message}", Chef::Exceptions::DeprecatedExitCode.new) + Chef::Application.fatal!("Cannot fetch config '#{config_location}': '#{error.class}: #{error.message}") end def read_local_config ::File.read(config_location) rescue Errno::ENOENT - Chef::Application.fatal!("Cannot load configuration from #{config_location}", Chef::Exceptions::DeprecatedExitCode.new) + Chef::Application.fatal!("Cannot load configuration from #{config_location}") rescue Errno::EACCES - Chef::Application.fatal!("Permissions are incorrect on #{config_location}. Please chmod a+r #{config_location}", Chef::Exceptions::DeprecatedExitCode.new) + Chef::Application.fatal!("Permissions are incorrect on #{config_location}. Please chmod a+r #{config_location}") end def config_missing? diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index be46f262a4..a09a3a062c 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -59,12 +59,6 @@ class Chef class UnsupportedAction < RuntimeError; end class MissingLibrary < RuntimeError; end - class DeprecatedExitCode < RuntimeError - def initalize - super "Exiting with a non RFC 062 Exit Code." - end - end - class CannotDetermineNodeName < RuntimeError def initialize super "Unable to determine node name: configure node_name or configure the system's hostname and fqdn" |