Sha256: c364d43fff3cc25d3ae4ffd604769cde86564ce07115b8606913669fe3f4da2d

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

module Katello
  module Events
    class GenerateHostApplicability
      EVENT_TYPE = 'generate_host_applicability'.freeze

      def self.retry_seconds
        180
      end

      def initialize(host_id)
        @host = ::Host.find_by_id(host_id)
        Rails.logger.warn "Host not found for ID #{object_id}" if @host.nil?
      end

      def run
        return unless @host

        begin
          ForemanTasks.async_task(::Actions::Katello::Applicability::Host::Generate, host_id: @host.id)
        rescue => e
          self.retry = true if e.is_a?(ForemanTasks::Lock::LockConflict)
          raise e
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katello-3.16.0.rc1.1 app/models/katello/events/generate_host_applicability.rb
katello-3.16.0.rc1 app/models/katello/events/generate_host_applicability.rb