Sha256: 93506bd4a33f72d84f1d5e2ce928a787686b1584067a304c5229097f953c74d9

Contents?: true

Size: 690 Bytes

Versions: 72

Compression:

Stored size: 690 Bytes

Contents

module InventoryUpload
  module TaskActions
    extend ActiveSupport::Concern

    class NothingToSyncError < Foreman::Exception
      MESSAGE = N_('Nothing to sync, there are no hosts with subscription for this organization.')

      def initialize(**params)
        super(self.class::MESSAGE, params)
      end
    end

    def start_inventory_sync(selected_org)
      subscribed_hosts = ForemanInventoryUpload::Generators::Queries.for_slice(
        Host.unscoped.where(organization: selected_org)
      )

      if subscribed_hosts.empty?
        raise NothingToSyncError
      end

      ForemanTasks.async_task(InventorySync::Async::InventoryFullSync, selected_org)
    end
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.0.3 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.59 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-11.0.2 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-11.0.1 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-11.0.0 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.58 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-10.0.2 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.57 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-10.0.1 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.56 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.55 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.54 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.53 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.52 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-8.0.52 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-9.0.51 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-8.0.51 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-7.0.48 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-7.0.47 app/controllers/concerns/inventory_upload/task_actions.rb
foreman_rh_cloud-8.0.50 app/controllers/concerns/inventory_upload/task_actions.rb