Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Fixes #19227 - katello-change-hostname health check
Browse files Browse the repository at this point in the history
This will check services before running the hostname change.
A `hammer ping` doesn't return a failing exit code if a
service is failing, so this makes use of grepping FAIL
  • Loading branch information
John Mitsch committed Apr 13, 2017
1 parent 1f35a43 commit c80b82c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions katello/katello-change-hostname
Expand Up @@ -106,20 +106,27 @@ STDOUT.print("This script will modify your system. You will need to re-register
response = yesno
unless response
STDOUT.puts "Hostname change aborted, no changes have been made to your system"
exit
exit(false)
end

unless options[:username] && options[:password]
STDOUT.puts "Username and/or Password options are missing!"
puts opt_parser
exit
exit(false)
end

if ARGV[0] && ARGV.count >= 1
new_hostname = ARGV[0]
else
puts opt_parser
exit
exit(false)
end

hammer_ping = `hammer ping | grep FAIL`
hammer_ping_failure = $?.success?
if hammer_ping_failure
STDOUT.puts "All services are not currently running, please check 'hammer ping'"
exit(false)
end

# Get the hostname from your system
Expand Down

0 comments on commit c80b82c

Please sign in to comment.