Project

General

Profile

Actions

Bug #37020

open

Host filter "origin = Puppet" does not work for csv export

Added by Manisha Singhal 5 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Steps to Reproduce:

1.Hosts->All hosts
2.Add Filter "origin = Puppet" and press search
3.export the host list result as a csv

Actual results:
The csv export does not match the host list result

Expected results:
The csv export should be identical to the host list result

Additional info:
The list from the GUI is correct, the csv export not.

There is a temporary fix to change this line and use includes instead of preload https://github.com/theforeman/foreman/blob/a1142ab9ef500e3206be1ff8a390431bc1b32de3/app/controllers/hosts_controller.rb#L58 And also remove the host_statuses and token exclusion from the association list. So, it should be

@hosts = search.includes(included_associations)

The issue is, the resources are sent to services/csv_exporter which uses find_each method to find data in batches and its silently failing because of timeout as preload is using multiple SQl-SELECTS and find_each runs out of time and shows the no. of records it could find. Whereas in includes it has whole data at once and it finds all records.
Also, Some of the records don't have :host_statuses, :tokens and those records are not being exported as well.

No data to display

Actions

Also available in: Atom PDF