summaryrefslogtreecommitdiff
path: root/lib/chef/application/exit_code.rb
diff options
context:
space:
mode:
authorNaomi Reeves <nreeves@fb.com>2020-08-12 14:17:54 -0700
committerNaomi Reeves <NaomiReeves@users.noreply.github.com>2020-08-20 22:05:09 -0700
commitfa84abaedf07d8d5aed8ee7509b3370140797835 (patch)
treea828ff8b02b44ad2791812202893bedd8778d0d4 /lib/chef/application/exit_code.rb
parent529a36c63ca8fdc1d58b02b4faa86a4e89e5b738 (diff)
downloadchef-fa84abaedf07d8d5aed8ee7509b3370140797835.tar.gz
define unique exit code for configuration failures and handle correctly
Signed-off-by: Naomi Reeves <NaomiReeves@users.noreply.github.com>
Diffstat (limited to 'lib/chef/application/exit_code.rb')
-rw-r--r--lib/chef/application/exit_code.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/application/exit_code.rb b/lib/chef/application/exit_code.rb
index 3235bfadeb..ee0621f5ce 100644
--- a/lib/chef/application/exit_code.rb
+++ b/lib/chef/application/exit_code.rb
@@ -36,6 +36,7 @@ class Chef
REBOOT_NEEDED: 37,
REBOOT_FAILED: 41,
# 42 was used by audit mode and should not be reused
+ CONFIG_FAILURE: 43,
CLIENT_UPGRADED: 213,
}.freeze
@@ -79,6 +80,8 @@ class Chef
VALID_RFC_062_EXIT_CODES[:REBOOT_NEEDED]
elsif reboot_failed?(exception)
VALID_RFC_062_EXIT_CODES[:REBOOT_FAILED]
+ elsif configuration_failure?(exception)
+ VALID_RFC_062_EXIT_CODES[:CONFIG_FAILURE]
elsif client_upgraded?(exception)
VALID_RFC_062_EXIT_CODES[:CLIENT_UPGRADED]
else
@@ -104,6 +107,12 @@ class Chef
end
end
+ def configuration_failure?(exception)
+ resolve_exception_array(exception).any? do |e|
+ e.is_a? Chef::Exceptions::ConfigurationError
+ end
+ end
+
def client_upgraded?(exception)
resolve_exception_array(exception).any? do |e|
e.is_a? Chef::Exceptions::ClientUpgraded