Class: Katello::TraceStatus
- Inherits:
-
HostStatus::Status
- Object
- HostStatus::Status
- Katello::TraceStatus
- Defined in:
- app/models/katello/trace_status.rb
Constant Summary collapse
- REQUIRE_REBOOT =
2- REQUIRE_PROCESS_RESTART =
1- UP_TO_DATE =
0- UNKNOWN =
-1
Class Method Summary collapse
Instance Method Summary collapse
- #relevant?(_options = {}) ⇒ Boolean
- #to_global(_options = {}) ⇒ Object
- #to_label(_options = {}) ⇒ Object
- #to_status(_options = {}) ⇒ Object
Class Method Details
.status_name ⇒ Object
7 8 9 |
# File 'app/models/katello/trace_status.rb', line 7 def self.status_name N_("Traces") end |
Instance Method Details
#relevant?(_options = {}) ⇒ Boolean
47 48 49 50 51 |
# File 'app/models/katello/trace_status.rb', line 47 def relevant?( = {}) # traces cannot be reported from hosts lower than el7 return false if host..try(:major).to_i.between?(1, 6) || !host.content_facet&.tracer_installed? host.content_facet.try(:uuid).present? end |
#to_global(_options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/katello/trace_status.rb', line 24 def to_global( = {}) case to_status when REQUIRE_REBOOT ::HostStatus::Global::ERROR when REQUIRE_PROCESS_RESTART ::HostStatus::Global::WARN when UP_TO_DATE ::HostStatus::Global::OK else ::HostStatus::Global::WARN end end |
#to_label(_options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/katello/trace_status.rb', line 11 def to_label( = {}) case to_status when REQUIRE_REBOOT N_("Reboot required") when REQUIRE_PROCESS_RESTART N_("One or more processes require restarting") when UP_TO_DATE N_("No processes require restarting") else N_("Unknown traces status") end end |
#to_status(_options = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/models/katello/trace_status.rb', line 37 def to_status( = {}) if host.host_traces.reboot_required.any? REQUIRE_REBOOT elsif host.host_traces.where.not(:app_type => "session").any? REQUIRE_PROCESS_RESTART else UP_TO_DATE end end |