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



62
63
64
65
66
67
68
69
70
71
# File 'lib/hammer_cli_katello/ping.rb', line 62

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

#request_optionsObject



83
84
85
# File 'lib/hammer_cli_katello/ping.rb', line 83

def request_options
  { with_authentication: false }
end

#send_requestObject



73
74
75
76
77
78
79
80
81
# File 'lib/hammer_cli_katello/ping.rb', line 73

def send_request
  super.tap do |data|
    data['services'] ||= {}
    data['services'].each do |_, service|
      service['_response'] =
        HammerCLIKatello::CommandExtensions::Ping.get_server_response(service)
    end
  end
end