Module: Actions::Helpers::ContentViewAutoPublisher
- Included in:
- Katello::ContentView::Promote, Katello::ContentView::Publish, Katello::ContentView::Remove, Katello::ContentView::RemoveFromEnvironment, Katello::ContentView::Update, Katello::ContentViewVersion::IncrementalUpdate, Katello::ContentViewVersion::RepublishRepositories, Katello::ContentViewVersion::VerifyChecksum
- Defined in:
- app/lib/actions/helpers/content_view_auto_publisher.rb
Class Method Summary collapse
Instance Method Summary collapse
- #auto_publish_view(_execution_plan) ⇒ Object
- #auto_publish_views(_execution_plan) ⇒ Object
- #trigger_auto_publish(request) ⇒ Object
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'app/lib/actions/helpers/content_view_auto_publisher.rb', line 4 def self.included(base) base.execution_plan_hooks.use :auto_publish_views, on: :success base.execution_plan_hooks.use :auto_publish_view, on: :stopped base.middleware.use ::Actions::Middleware::AutoPublishContext end |
Instance Method Details
#auto_publish_view(_execution_plan) ⇒ Object
23 24 25 26 27 28 |
# File 'app/lib/actions/helpers/content_view_auto_publisher.rb', line 23 def auto_publish_view(_execution_plan) request = ::Katello::ContentViewAutoPublishRequest.find_by(content_view_id: input[:auto_publish_content_view_id]) return unless request trigger_auto_publish(request) end |
#auto_publish_views(_execution_plan) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/lib/actions/helpers/content_view_auto_publisher.rb', line 10 def auto_publish_views(_execution_plan) version = ::Katello::ContentViewVersion.find_by(id: output[:auto_publish_content_view_version_id]) return unless version content_views = ::Katello::ContentView.auto_publishable.where(id: output[:auto_publish_content_view_ids]) content_views.each do |cv| request = ::Katello::ContentViewManager.request_auto_publish(content_view: cv, content_view_version: version) next unless request trigger_auto_publish(request) end end |
#trigger_auto_publish(request) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/lib/actions/helpers/content_view_auto_publisher.rb', line 30 def trigger_auto_publish(request) ::Katello::ContentViewManager.trigger_auto_publish!(request: request) rescue StandardError => e begin ::Katello::ContentViewManager.auto_publish_log(request, "unrecoverable error #{e}") ::Katello::UINotifications::ContentView::AutoPublishFailure.deliver!(request.content_view) rescue => second ::Katello::ContentViewManager.auto_publish_log(request, "notification delivery failed #{second}") end end |