Class: Katello::Events::DeleteLatestContentViewVersion
- Inherits:
-
Object
- Object
- Katello::Events::DeleteLatestContentViewVersion
- Defined in:
- app/models/katello/events/delete_latest_content_view_version.rb
Constant Summary collapse
- EVENT_TYPE =
'delete_latest_content_view_version'.freeze
Instance Attribute Summary collapse
-
#content_view ⇒ Object
readonly
Returns the value of attribute content_view.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#retry ⇒ Object
Returns the value of attribute retry.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(content_view_id) {|_self| ... } ⇒ DeleteLatestContentViewVersion
constructor
A new instance of DeleteLatestContentViewVersion.
- #run ⇒ Object
Constructor Details
#initialize(content_view_id) {|_self| ... } ⇒ DeleteLatestContentViewVersion
Returns a new instance of DeleteLatestContentViewVersion.
13 14 15 16 17 |
# File 'app/models/katello/events/delete_latest_content_view_version.rb', line 13 def initialize(content_view_id) @content_view = ::Katello::ContentView.find_by_id(content_view_id) Rails.logger.warn "Content View not found for ID #{object_id}" if @content_view.nil? yield(self) if block_given? end |
Instance Attribute Details
#content_view ⇒ Object (readonly)
Returns the value of attribute content_view.
6 7 8 |
# File 'app/models/katello/events/delete_latest_content_view_version.rb', line 6 def content_view @content_view end |
#metadata ⇒ Object
Returns the value of attribute metadata.
7 8 9 |
# File 'app/models/katello/events/delete_latest_content_view_version.rb', line 7 def @metadata end |
#retry ⇒ Object
Returns the value of attribute retry.
7 8 9 |
# File 'app/models/katello/events/delete_latest_content_view_version.rb', line 7 def retry @retry end |
Class Method Details
.retry_seconds ⇒ Object
9 10 11 |
# File 'app/models/katello/events/delete_latest_content_view_version.rb', line 9 def self.retry_seconds 18 end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/katello/events/delete_latest_content_view_version.rb', line 19 def run return unless content_view begin ForemanTasks.async_task(::Actions::Katello::ContentView::Remove, content_view, content_view_versions: [content_view.latest_version_object], content_view_environments: content_view.latest_version_object.content_view_environments) rescue => e self.retry = true if e.is_a?(ForemanTasks::Lock::LockConflict) deliver_failure_notification raise e end end |