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.8.3 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.9 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.8 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.7 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.8.2 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.6 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.8.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.5 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.8.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.4 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.3 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.2 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.1 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.6.7 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.7.0 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.6.6 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.6.5 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.6.4 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.6.3 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb
foreman_openscap-0.6.2 app/models/concerns/foreman_openscap/smart_proxy_extensions.rb