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 Chef RFC 062 https://github.com/chef/chef-rfc/blob/master/rfc062-exit-status.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,
  AUDIT_MODE_FAILURE: 42,
  CLIENT_UPGRADED: 213,
}
DEPRECATED_RFC_062_EXIT_CODES =
{
  DEPRECATED_FAILURE: -1,
}

Class Method Summary collapse

Class Method Details

.normalize_exit_code(exit_code = nil) ⇒ Object


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

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