Sha256: 610d885e657dc872747095c952f60d51ebee667de664eef53976ccb7f34ac19e

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

#
# Copyright 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

module Katello
  class Api::V1::PingController < Api::V1::ApiController

    skip_before_filter :authorize # ok - anyone authenticated can ask for status
    skip_before_filter :require_user, :only => [:server_status]

    api :GET, "/ping", "Shows status of system and it's subcomponents"
    description "This service is only available for authenticated users"
    def index
      resource = Hash[Ping.ping.collect { |k, v| [{:status => :result, :services => :status}[k], v] }]
      resource[:status].each_key do |key|
        resource[:status][key][:result] = resource[:status][key][:status]
      end
      respond_for_show :resource => resource
    end

    api :GET, "/status", "Shows version information"
    description "This service is also available for unauthenticated users"
    def server_status
      # rubocop:disable SymbolName
      status = { :release    => Katello.config.app_name,
                 :version    => Katello.config.katello_version,
                 :standalone => true,
                 :timeUTC    => Time.now.getutc,
                 :result     => true }
      respond_for_show :resource => status
    end

    api :GET, "/version", "Shows name and version information"
    description "This service is only available for authenticated users"
    def version
      respond_for_show :resource => { :name => Katello.config.app_mode, :version => Katello.config.katello_version }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katello-1.5.0 app/controllers/katello/api/v1/ping_controller.rb