Project

General

Profile

« Previous | Next » 

Revision cb9a1fed

Added by Ewoud Kohl van Wijngaarden about 4 years ago

Fixes #29208 - Use fail_and_exit where possible

This replaces various custom definition of the error method with the
central fail_and_exit.

View differences:

katello/hooks/pre/20-certs_update.rb
SSL_BUILD_DIR = param('certs', 'ssl_build_dir').value
CHECK_SCRIPT = `which katello-certs-check`.strip
def error(message)
logger.error message
say message
exit 101
end
def mark_for_update(cert_name, hostname = nil)
path = File.join(*[SSL_BUILD_DIR, hostname, cert_name].compact)
puts "Marking certificate #{path} for update"
......
key_file = param('certs', 'server_key').value
if app_value('certs_update_server_ca') && !module_enabled?('katello')
error "--certs-update-server-ca needs to be used with katello"
fail_and_exit("--certs-update-server-ca needs to be used with katello", 101)
end
if param('foreman_proxy_certs', 'foreman_proxy_fqdn')
......
check_cmd = %(#{CHECK_SCRIPT} -c "#{cert_file}" -k "#{key_file}" -b "#{ca_file}")
output = `#{check_cmd} 2>&1`
unless $CHILD_STATUS.success?
error "Command '#{check_cmd}' exited with #{$CHILD_STATUS.exitstatus}:\n #{output}"
fail_and_exit("Command '#{check_cmd}' exited with #{$CHILD_STATUS.exitstatus}:\n #{output}", 101)
end
end

Also available in: Unified diff