Class: Chef::Application::ExitCode

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/application/exit_code.rb

Overview

These are the exit codes defined in the exit codes design document github.com/chef/chef/blob/main/docs/dev/design_documents/client_exit_codes.md

Constant Summary collapse

VALID_RFC_062_EXIT_CODES =

-1 is defined as DEPRECATED_FAILURE in RFC 062, so it is not enumerated in an active constant.

{
  SUCCESS: 0,
  GENERIC_FAILURE: 1,
  SIGINT_RECEIVED: 2,
  SIGTERM_RECEIVED: 3,
  REBOOT_SCHEDULED: 35,
  REBOOT_NEEDED: 37,
  REBOOT_FAILED: 41,
  # 42 was used by audit mode and should not be reused
  CONFIG_FAILURE: 43,
  CLIENT_UPGRADED: 213,
}.freeze
DEPRECATED_RFC_062_EXIT_CODES =
{
  DEPRECATED_FAILURE: -1,
}.freeze

Class Method Summary collapse

Class Method Details

.normalize_exit_code(exit_code = nil) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/chef/application/exit_code.rb', line 49

def normalize_exit_code(exit_code = nil)
  normalized_exit_code = normalize_legacy_exit_code(exit_code)
  if valid_exit_codes.include? normalized_exit_code
    normalized_exit_code
  else
    Chef::Log.warn(non_standard_exit_code_warning(normalized_exit_code))
    VALID_RFC_062_EXIT_CODES[:GENERIC_FAILURE]
  end
end