Sha256: 1d44578f4d211e86eec9d76f10fada0e44ddd6378011739ecb544644db3377b1

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

module InventorySync
  module Async
    class InventoryScheduledSync < ::Actions::EntryAction
      include ::Actions::RecurringAction
      include ForemanInventoryUpload::Async::DelayedStart

      def plan
        unless Setting[:allow_auto_inventory_upload]
          logger.debug(
            'The scheduled process is disabled due to the "allow_auto_inventory_upload"
            setting being set to false.'
          )
          return
        end

        after_delay do
          Organization.unscoped.each do |org|
            plan_org_sync(org)
          end
        end
      end

      def plan_org_sync(org)
        plan_action InventoryFullSync, org
      end

      def logger
        action_logger
      end

      def rescue_strategy_for_self
        Dynflow::Action::Rescue::Fail
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_rh_cloud-7.0.48 lib/inventory_sync/async/inventory_scheduled_sync.rb
foreman_rh_cloud-7.0.47 lib/inventory_sync/async/inventory_scheduled_sync.rb
foreman_rh_cloud-8.0.46 lib/inventory_sync/async/inventory_scheduled_sync.rb
foreman_rh_cloud-6.0.45 lib/inventory_sync/async/inventory_scheduled_sync.rb
foreman_rh_cloud-7.0.46 lib/inventory_sync/async/inventory_scheduled_sync.rb
foreman_rh_cloud-7.0.45 lib/inventory_sync/async/inventory_scheduled_sync.rb
foreman_rh_cloud-6.0.44 lib/inventory_sync/async/inventory_scheduled_sync.rb