Sha256: 1f3d58190e12fa5db9371b834f96b8b815dd873632372fa182f18f69092e6f4c

Contents?: true

Size: 801 Bytes

Versions: 33

Compression:

Stored size: 801 Bytes

Contents

module ForemanInventoryUpload
  class TasksController < ::ApplicationController
    def create
      selected_org = Organization.current
      subscribed_hosts_ids = Set.new(
        ForemanInventoryUpload::Generators::Queries.for_slice(
          Host.unscoped.where(organization: selected_org)
        ).pluck(:id)
      )

      if subscribed_hosts_ids.empty?
        return render json: {
          message: N_('Nothing to sync, there are no hosts with subscription for this organization.'),
        }, status: :method_not_allowed
      else
        host_statuses = InventorySync::Async::InventoryFullSync.perform_now(selected_org)
      end

      render json: {
        syncHosts: host_statuses[:sync],
        disconnectHosts: host_statuses[:disconnect],
      }, status: :ok
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
foreman_rh_cloud-2.0.18.1 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-3.0.18.1 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-1.0.18 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-2.0.18 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-3.0.18 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-1.0.17 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-2.0.17 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-3.0.17 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-2.0.16 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-1.0.16 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-3.0.16 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-1.0.15 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-2.0.15 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-3.0.15 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-3.0.14 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-2.0.14 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-1.0.14 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-0.9.14 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-0.9.13.1 app/controllers/foreman_inventory_upload/tasks_controller.rb
foreman_rh_cloud-1.0.13.1 app/controllers/foreman_inventory_upload/tasks_controller.rb