Sha256: e6b0e34f65e9582cf13285c1cde05c2d459dc7fd1e8771492a7c489277c084fd

Contents?: true

Size: 824 Bytes

Versions: 15

Compression:

Stored size: 824 Bytes

Contents

module ForemanOpenscap::PolicyDashboard
  class Data
    attr_reader :report

    def initialize(policy, filter = "")
      @policy = policy
      @filter = filter
      @report = {}
      fetch_data
    end

    private
    attr_writer :report

    def hosts
      @hosts ||= Host.authorized(:view_hosts, Host)
    end

    def fetch_data
      report.update(
        {:compliant_hosts => Host::Managed.comply_with(@policy).count,
         :incompliant_hosts => Host::Managed.incomply_with(@policy).count,
         :inconclusive_hosts => Host::Managed.inconclusive_with(@policy).count,
         :report_missing => Host::Managed.policy_reports_missing(@policy).count,
         :assigned_hosts => @policy.assets.hosts.count,
         :unassigned_hosts => hosts.count - @policy.assets.hosts.count
        })
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
foreman_openscap-0.7.1 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.7 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.7.0 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.6 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.5 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.4 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.3 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.2 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.1 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.6.0 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.5.4 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.5.3 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.5.2 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.5.1 app/services/foreman_openscap/policy_dashboard/data.rb
foreman_openscap-0.5.0 app/services/foreman_openscap/policy_dashboard/data.rb