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



70
71
72
73
74
75
76
77
78
79
# File 'lib/hammer_cli_katello/ping.rb', line 70

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



91
92
93
# File 'lib/hammer_cli_katello/ping.rb', line 91

def request_options
  { with_authentication: false }
end

#send_requestObject



81
82
83
84
85
86
87
88
89
# File 'lib/hammer_cli_katello/ping.rb', line 81

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