Class: HammerCLIKatello::PingCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/hammer_cli_katello/ping.rb

Instance Method Summary collapse

Methods included from ResolverCommons

included

Instance Method Details

#executeObject

output do



44
45
46
47
48
49
50
51
52
53
# File 'lib/hammer_cli_katello/ping.rb', line 44

def execute
  d = send_request
  print_data d
  service_statuses = d['services'].values.map { |v| v['status'] }
  if d['status'] == _("FAIL") || service_statuses.include?(_("FAIL"))
    1
  else
    HammerCLI::EX_OK
  end
end

#send_requestObject



55
56
57
58
59
60
61
# File 'lib/hammer_cli_katello/ping.rb', line 55

def send_request
  super.tap do |data|
    data['services'].each do |_, service|
      service['_response'] = get_server_response(service)
    end
  end
end