Sha256: 42918a77c118aa254385f41651b194e1599078aec1aeaa5489f218387c848af6

Contents?: true

Size: 1.14 KB

Versions: 158

Compression:

Stored size: 1.14 KB

Contents

module Katello
  module Events
    class AutoPublishCompositeView
      EVENT_TYPE = 'auto_publish_composite_view'.freeze

      attr_reader :composite_view
      attr_accessor :metadata, :retry

      def self.retry_seconds
        180
      end

      def initialize(composite_view_id)
        @composite_view = ::Katello::ContentView.find_by_id(composite_view_id)
        Rails.logger.warn "Content View not found for ID #{object_id}" if @composite_view.nil?
        yield(self) if block_given?
      end

      def run
        return unless composite_view

        begin
          ForemanTasks.async_task(::Actions::Katello::ContentView::Publish,
                              composite_view,
                              metadata[:description],
                              triggered_by: metadata[:version_id])
        rescue => e
          self.retry = true if e.is_a?(ForemanTasks::Lock::LockConflict)
          deliver_failure_notification
          raise e
        end
      end

      private

      def deliver_failure_notification
        ::Katello::UINotifications::ContentView::AutoPublishFailure.deliver!(composite_view)
      end
    end
  end
end

Version data entries

158 entries across 158 versions & 1 rubygems

Version Path
katello-4.0.0.rc3 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.2.1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.2 app/models/katello/events/auto_publish_composite_view.rb
katello-3.17.3 app/models/katello/events/auto_publish_composite_view.rb
katello-4.0.0.rc2 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.1.1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.17.2 app/models/katello/events/auto_publish_composite_view.rb
katello-4.0.0.rc1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.0 app/models/katello/events/auto_publish_composite_view.rb
katello-3.17.1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.16.2 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.0.rc2.1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.0.rc2 app/models/katello/events/auto_publish_composite_view.rb
katello-3.17.0 app/models/katello/events/auto_publish_composite_view.rb
katello-3.18.0.rc1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.17.0.rc2.2 app/models/katello/events/auto_publish_composite_view.rb
katello-3.17.0.rc2.1 app/models/katello/events/auto_publish_composite_view.rb
katello-3.16.1.2 app/models/katello/events/auto_publish_composite_view.rb
katello-3.16.1.1 app/models/katello/events/auto_publish_composite_view.rb