Bug 1655508

Summary: Search filters not working as expected on Satellite Dashboard.
Product: Red Hat Satellite Reporter: maneesh verma <mverma>
Component: DashboardAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Radovan Drazny <rdrazny>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: egolov, mhulan, mschibli, rraghuwa, sgraessl, shisingh, tc, vmeghana
Target Milestone: 6.6.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: foreman-1.22.0-0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 19:48:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description maneesh verma 2018-12-03 10:35:09 UTC
Description of problem:

The two reports in Host COnfiguration status widget of Dashboard are not working fine.

1- Last seen reports.
2- Hosts with Alert disabled

How reproducible:

Every time we click on Host COnfiguration Status for Puppet and Ansible Widget.

Report names- Host with no reports and Hosts with alerts disabled.

Steps to Reproduce:
1. Click on the widget shows Hosts with No reports.

It will search with Query- origin = Puppet and last_report > "35 minutes ago" and not has last_report and status.enabled = true

2. Click on the Widget Hosts with alert disabled.

it will search with query - last_report > "30 minutes ago" and status.enabled = false


Actual results:

The query fails to get the proper results and shows no hostnames.

If we remote the time interval the search works fine.


Expected results:

The search should show the correct result.




Additional info:

Impacted code.

/usr/share/foreman/app/helpers/dashboard_helper.rb:
  def search_filter_with_origin(filter, origin, within_interval = false)
    interval_setting = report_origin_interval_setting(origin)
    additional_filters = []
    additional_filters << "origin = #{origin}" if origin
    additional_filters << "last_report #{within_interval ? '<' : '>'} \"#{interval_setting} minutes ago\"" if out_of_sync_enabled?(origin)
    (additional_filters + [filter]).join(' and ')
  end

Comment 8 Radovan Drazny 2019-07-17 11:23:04 UTC
Verified on Sat 6.6 Snap 11. Dasboard widgets for Ansible, Puppet and All Hosts contain following queries:

Ansible
Hosts with no reports: origin = Ansible and not has last_report and status.enabled = true
Hosts with alerts disabled: origin = Ansible and status.enabled = false

Puppet
Hosts with no reports: origin = Puppet and not has last_report and status.enabled = true
Hosts with alerts disabled: origin = Puppet and status.enabled = false

All
Hosts with no reports: not has last_report and status.enabled = true
Hosts with alerts disabled: status.enabled = false

Comment 9 Bryan Kearney 2019-10-22 19:48:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3172