Class: ForemanOpenscap::Oval::SyncOvalContents
- Inherits:
-
Object
- Object
- ForemanOpenscap::Oval::SyncOvalContents
- Defined in:
- app/services/foreman_openscap/oval/sync_oval_contents.rb
Instance Method Summary collapse
Instance Method Details
#sync(oval_content) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/foreman_openscap/oval/sync_oval_contents.rb', line 4 def sync(oval_content) begin content_blob = fetch_content_blob(oval_content.url) rescue StandardError => e oval_content.errors.add(:base, "#{fail_msg oval_content}, cause: #{e.}") return oval_content end unless content_blob oval_content.errors.add(:base, fail_msg(oval_content)) return oval_content end oval_content.scap_file = content_blob oval_content end |
#sync_all ⇒ Object
20 21 22 23 |
# File 'app/services/foreman_openscap/oval/sync_oval_contents.rb', line 20 def sync_all to_sync = ForemanOpenscap::OvalContent.where.not(:url => nil) to_sync.map { |content| content.tap { |item| sync(item).save } } end |