Sha256: fca72a497951f5a934751bbd8fe7d3595dcdc4e051d1b44a9671e8837ad2a1a6
Contents?: true
Size: 1.23 KB
Versions: 71
Compression:
Stored size: 1.23 KB
Contents
module ForemanOpenscap class ComplianceStatus < ::HostStatus::Status COMPLIANT = 0 INCONCLUSIVE = 1 INCOMPLIANT = 2 def self.status_name N_('Compliance') end def self.bit_mask(status) "#{ArfReport::BIT_NUM * ArfReport::METRIC.index(status)} & #{ArfReport::MAX}" end def to_label(options = {}) case to_status when COMPLIANT N_('Compliant') when INCONCLUSIVE N_('Inconclusive') when INCOMPLIANT N_('Incompliant') else N_('Unknown Compliance status') end end def to_global(options = {}) case to_status when COMPLIANT ::HostStatus::Global::OK when INCONCLUSIVE ::HostStatus::Global::WARN else ::HostStatus::Global::ERROR end end def relevant?(options = {}) # May fail host status during migration return false unless ForemanOpenscap::Asset.table_exists? host.policies.present? end def to_status(options = {}) latest_reports = host.policies.map { |p| host.last_report_for_policy p }.flatten return INCOMPLIANT if latest_reports.any?(&:failed?) return INCONCLUSIVE if latest_reports.any?(&:othered?) COMPLIANT end end end
Version data entries
71 entries across 71 versions & 1 rubygems