Sha256: 5176a95042986079a3a8065bcc2c9e30b9e163ceb97209fc141cdd16a973654e

Contents?: true

Size: 698 Bytes

Versions: 66

Compression:

Stored size: 698 Bytes

Contents

module ForemanOpenscap
  module SmartProxyExtensions
    extend ActiveSupport::Concern

    included do
      has_many :openscap_hostgroups, :foreign_key => 'openscap_proxy_id', :class_name => "::Hostgroup"
      has_many :openscap_hosts, :foreign_key => 'openscap_proxy_id', :class_name => "::Host"
      has_many :arf_reports, :foreign_key => 'openscap_proxy_id', :class_name => "ForemanOpenscap::ArfReport"
      PORT_MATCH = /:(\d+)\z/
      after_destroy :delete_associated_arf_reports
    end

    def port
      url.match(PORT_MATCH)[1]
    end

    private

    def delete_associated_arf_reports
      ForemanOpenscap::ArfReport.where(:openscap_proxy_id => id).delete_all
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
foreman_openscap-0.6.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.6.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.5.4 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.5.3 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.5.2 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.5.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb