class Crowbar::Client::Command::Services::ListServiceRestarts

Implementation for the List Restarts command

Public Instance Methods

execute() click to toggle source
# File lib/crowbar/client/command/services/list_restarts.rb, line 33
def execute
  request.process do |request|
    case request.code
    when 200
      formatter = Formatter::Hash.new(
        format: "json",
        headings: ["Node"],
        values: request.parsed_response
      )

      if formatter.empty?
        err "No restarts"
      else
        say formatter.result
      end
    else
      err request.parsed_response["error"]
    end
  end
end
request() click to toggle source
# File lib/crowbar/client/command/services/list_restarts.rb, line 27
def request
  @request ||= Request::Services::ListServiceRestarts.new(
    *args
  )
end