Error when paging through facts

I’m using Foreman 1.18 with Puppet Server 5.3.3, both on the same host. It’s pretty much a stock install using the Foreman Installer, recently upgraded from 1.17. Today I noticed that I get an error in the Foreman web GUI when I try to page through facts for the foreman server. The first page of facts displays without any problem, but if I try to view the next page or skip to the last page, I get an error that has something to do with a parent_fact.

OopsOops, we’re sorry but something went wrong No route matches {:action=>“index”, :controller=>“fact_values”, :host_id=>“foreman.mydomain.com”, :parent_fact=>“mountpoints::/”}, possible unmatched constraints: [:parent_fact]

A few more details:

  • There are 106 facts for the host, and by default the page displays 20 at a time. If I change that to 50, it displays 50 facts without any error. I can also change the per_page parameter to 150 in the URL and it will display them all without error.
  • If I display all of the facts by changing per_page to 150 in the URL I get an error if I then try to expand the mountpoints or partitions tree of facts.
  • On another host I can page through all of the facts, but if I click to expand mountpoints or partitions I get a similar error.
  • Other “trees” of facts will display through the GUI without any problem, and they are all returned when I run “puppet facts query” on the foreman server.
  • If I exclude mountpoints and partitions fact patterns in the search then I can page through all of the facts without error.

This works:

host = foreman.mydomain.com and fact !~ mountpoints% and fact !~ partitions%

Here is the production log showing the error and full trace:
facts_paging_error.gz (2.8 KB)

Is there a relevant known issue? I checked Redmine and found this old issue but I’m not certain that it is related.
https://projects.theforeman.org/issues/16818

Thanks for any help!

I can confirm this is still present in nightly code, and is indeed the issue you found on redmine. The issue is caused when a nested fact has a parent containing / character.

Okay, thanks for the confirmation.

I get this error (on 1.18.1, 1.19.0 & 1.20.0-develop) and is simple to reproduce!

Monitor -> Facts click on ‘mountpoints’

https://1.2.3.4/hosts/f120dev.example.com/parent_facts/mountpoints/facts

In my case it looks like the issue is with a ‘fact’ ending in the / character.

A little more testing I tried clicking on ‘partitions’ and got the same error.

The same problem appears with Ansible local facts. This is very sad because we want to use them as filters to run playbooks.

any progress on fixing this?
still broken in 1.21.3

Still broke on 1.22.0