Sha256: 65b9224f3119e2875cd4fb1da01088d83d1aefbd9b90779dca297e01ce163040

Contents?: true

Size: 703 Bytes

Versions: 40

Compression:

Stored size: 703 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].to_i
    end

    private

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

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
foreman_openscap-10.1.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-10.0.3 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-10.0.2 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-10.0.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-10.0.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-9.0.4 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-9.0.3 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-9.0.2 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-9.0.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-9.0.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-8.0.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-7.1.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-7.1.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-7.0.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-6.0.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-5.2.3 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-5.2.2 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-5.1.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-5.2.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-5.2.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb