Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #19334 - consider out of date as ok #51

Merged
merged 1 commit into from May 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 3 additions & 9 deletions app/helpers/foreman_virt_who_configure/configs_helper.rb
Expand Up @@ -26,9 +26,7 @@ def config_report_status(config)
message = case config.status
when :unknown
_('No Report Yet')
when :ok
l(config.last_report_at, :format => :long)
when :error
when :ok, :out_of_date
l(config.last_report_at, :format => :long)
else
_('Unknown configuration status')
Expand All @@ -43,10 +41,8 @@ def config_report_status_icon(config)

def report_status_class(status)
icon_class = case status
when :ok
when :ok, :out_of_date
'pficon-ok'
when :error
'pficon-error-circle-o'
when :unknown
'pficon-info'
else
Expand All @@ -58,12 +54,10 @@ def report_status_class(status)

def status_class(status)
case status
when :ok
when :ok, :out_of_date
'status-ok'.html_safe
when :unknown
'status-info'.html_safe
when :error
'status-error'.html_safe
else
'status-warn'.html_safe
end
Expand Down
9 changes: 5 additions & 4 deletions app/models/foreman_virt_who_configure/config.rb
Expand Up @@ -49,15 +49,15 @@ class Config < ActiveRecord::Base

STATUSES = {
'ok' => N_('OK'),
'error' => N_('Error'),
'out_of_date' => N_('No change'),
'unknown' => N_('Unknown')
}

STATUS_DESCRIPTIONS = Hash.new(N_('Unknown configuration status, caused by unexpected conditions')).merge(
{
:unknown => N_('The configuration was not deployed yet or the virt-who was unable to report the status'),
:ok => N_('The virt-who report arrived within the interval'),
:error => N_('The virt-who report has not arrived within the interval, please check the virt-who reporter status and logs')
:out_of_date => N_('The virt-who report has not arrived within the interval, which indicates there was no change on hypervisor')
}
)

Expand Down Expand Up @@ -107,7 +107,7 @@ def self.search_by_status(key, operator, value)
sanitize_sql_for_conditions([' out_of_date_at >= ? ', DateTime.now.utc.to_s(:db)])
when 'unknown'
sanitize_sql_for_conditions({:last_report_at => nil})
when 'error'
when 'out_of_date'
sanitize_sql_for_conditions([' out_of_date_at < ? ', DateTime.now.utc.to_s(:db)])
end
{ :conditions => condition }
Expand Down Expand Up @@ -188,7 +188,8 @@ def status
when !self.out_of_date?
:ok
else
:error
# out of date is currently considered ok too, virt-who does not send any report if there's no change on hypervisor
:out_of_date
end
end

Expand Down
Expand Up @@ -16,7 +16,7 @@
<td><%= scope.where(:last_report_at => nil).count %></td>
</tr>
<tr>
<td><%= link_to _("Out Of Date"), foreman_virt_who_configure_configs_path(:search => "status = error") %></td>
<td><%= link_to _("Out Of Date"), foreman_virt_who_configure_configs_path(:search => "status = out_of_date") %></td>
<td><%= out_of_date.count %></td>
</tr>
<tr>
Expand Down