class Crowbar::Client::Command::Services::ListRestartFlags

Implementation for the List Restarts command

Public Instance Methods

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

      if formatter.empty?
        err "No flags set"
      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/restart_flags.rb, line 27
def request
  @request ||= Request::Services::ListRestartFlags.new(
    *args
  )
end