Module: ForemanOpenscap::DataStreamContent

Extended by:
ActiveSupport::Concern
Included in:
ScapContent, TailoringFile
Defined in:
app/models/concerns/foreman_openscap/data_stream_content.rb

Instance Method Summary collapse

Instance Method Details

#create_or_update_profile(profile_id, title) ⇒ Object



22
23
24
25
26
27
# File 'app/models/concerns/foreman_openscap/data_stream_content.rb', line 22

def create_or_update_profile(profile_id, title)
  profile = ScapContentProfile.find_by(:profile_id => profile_id, "#{self.class.to_s.demodulize.underscore}_id".to_sym => id)
  return ScapContentProfile.create(:profile_id => profile_id, :title => title, "#{self.class.to_s.demodulize.underscore}_id".to_sym => id) unless profile
  profile.update(:title => title) unless profile.title == title
  profile
end

#create_profilesObject



16
17
18
19
20
# File 'app/models/concerns/foreman_openscap/data_stream_content.rb', line 16

def create_profiles
  fetch_profiles.each do |key, title|
    create_or_update_profile key, title
  end
end

#proxy_urlObject



12
13
14
# File 'app/models/concerns/foreman_openscap/data_stream_content.rb', line 12

def proxy_url
  @proxy_url ||= SmartProxy.with_features('Openscap').find(&:ping)&.url
end