Class: ForemanInventoryUpload::CloudStatusController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_inventory_upload/cloud_status_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/foreman_inventory_upload/cloud_status_controller.rb', line 3

def index
  organizations = User.current.my_organizations

  ping_service = ForemanRhCloud::CloudPingService.new(organizations, logger)
  ping_result = ping_service.ping
  ping_result[:cert_auth] =  ping_result[:cert_auth].map do |org, status_hash|
    status_hash.merge(
      {
        org_id: org.id,
        org_name: org.name,
      }
    )
  end

  render json: {
    ping: ping_result,
  }, status: :ok
end

#loggerObject



22
23
24
# File 'app/controllers/foreman_inventory_upload/cloud_status_controller.rb', line 22

def logger
  Foreman::Logging.logger('app')
end