Project

General

Profile

Bug #16818

nested facts can lead to invalid links

Added by Ohad Levy over 3 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
-
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

given the fact key mountpoints::/boot the following link is created which is 404
https://foreman.example.com/hosts/host.example.com/parent_facts/mountpoints::%2Fboot/facts


Related issues

Related to Foreman - Feature #26852: Add mountpoint and partition exclude fact patternsClosed
Has duplicate Foreman - Bug #24774: Missing routes when checking facts containing '/'Duplicate
Has duplicate Ansible - Bug #25296: Viewing Ansible fact causes errorsDuplicate
Has duplicate Foreman - Bug #25807: Error viewing external structured puppet factDuplicate

Associated revisions

Revision c9648b06 (diff)
Added by Timo Goebel 7 months ago

fixes #16818 - support slash in fact name

History

#1 Updated by Gheorghe Nedelcu over 3 years ago

Ohad Levy wrote:

given the fact key mountpoints::/boot the following link is created which is 404
https://foreman.example.com/hosts/host.example.com/parent_facts/mountpoints::%2Fboot/facts

More info on this:
I have a custom fact in module which is returning this:

Debug: Facter: fact "db2" has resolved to {
Install => {
10.1 => {
Version => "10.1.0.0",
FixPack => "0",
Path => "/opt/ibm/db2/V10.1"
}
}
}.

The Foreman's fact page cannot be loaded and gives this in the log:

2016-11-03 04:14:12 ac50fd30 [app] [I] Started GET "/hosts/***********.com/parent_facts/db2/facts" for 192.168.1.14 at 2016-11-03 04:14:12 -0500
2016-11-03 04:14:12 ac50fd30 [app] [I] Processing by FactValuesController#index as HTML
2016-11-03 04:14:12 ac50fd30 [app] [I]   Parameters: {"host_id"=>"***********.com", "parent_fact"=>"db2"}
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered fact_values/_fact.html.erb (4.5ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered fact_values/index.html.erb within layouts/application (30.2ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered common/_searchbar.html.erb (22.5ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered layouts/_application_content.html.erb (23.7ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_user_dropdown.html.erb (8.2ms)
2016-11-03 04:14:12 ac50fd30 [app] [I] Read fragment views/tabs_and_title_records-3 (0.2ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_org_switcher.html.erb (0.5ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_submenu.html.erb (5.6ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_submenu.html.erb (2.1ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_submenu.html.erb (5.9ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_submenu.html.erb (7.4ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_submenu.html.erb (4.2ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_submenu.html.erb (4.4ms)
2016-11-03 04:14:12 ac50fd30 [app] [I] Write fragment views/tabs_and_title_records-3 (1.3ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered home/_topbar.html.erb (56.6ms)
2016-11-03 04:14:12 ac50fd30 [app] [I]   Rendered layouts/base.html.erb (60.9ms)
2016-11-03 04:14:12 ac50fd30 [app] [I] Completed 200 OK in 157ms (Views: 112.0ms | ActiveRecord: 11.6ms)
2016-11-03 04:14:14 ac50fd30 [app] [I] Started GET "/hosts/***********.com/parent_facts/db2::Install/facts" for 192.168.1.14 at 2016-11-03 04:14:14 -0500
2016-11-03 04:14:14 ac50fd30 [app] [I] Processing by FactValuesController#index as HTML
2016-11-03 04:14:14 ac50fd30 [app] [I]   Parameters: {"host_id"=>"***********.com", "parent_fact"=>"db2::Install"}
2016-11-03 04:14:14 ac50fd30 [app] [I]   Rendered fact_values/_fact.html.erb (4.1ms)
2016-11-03 04:14:14 ac50fd30 [app] [I]   Rendered fact_values/index.html.erb within layouts/application (25.1ms)
2016-11-03 04:14:14 ac50fd30 [app] [I]   Rendered common/_searchbar.html.erb (13.0ms)
2016-11-03 04:14:14 ac50fd30 [app] [I]   Rendered layouts/_application_content.html.erb (14.2ms)
2016-11-03 04:14:14 ac50fd30 [app] [I]   Rendered home/_user_dropdown.html.erb (3.7ms)
2016-11-03 04:14:14 ac50fd30 [app] [I] Read fragment views/tabs_and_title_records-3 (0.3ms)
2016-11-03 04:14:14 ac50fd30 [app] [I]   Rendered home/_topbar.html.erb (13.1ms)
2016-11-03 04:14:14 ac50fd30 [app] [I]   Rendered layouts/base.html.erb (16.9ms)
2016-11-03 04:14:14 ac50fd30 [app] [I] Completed 200 OK in 76ms (Views: 54.5ms | ActiveRecord: 6.7ms)
2016-11-03 04:14:19 ac50fd30 [app] [I] Started GET "/hosts/***********.com/parent_facts/db2::Install::10.1/facts" for 192.168.1.14 at 2016-11-03 04:14:19 -0500
2016-11-03 04:14:19 ac50fd30 [app] [F] 
 | ActionController::RoutingError (No route matches [GET] "/hosts/***********.com/parent_facts/db2::Install::10.1/facts"):
 |   lib/middleware/tagged_logging.rb:18:in `call'
 | 
 | 
2016-11-03 04:14:19 ac50fd30 [app] [I] Started GET "/hosts/***********.com/parent_facts/db2::Install::10.1/facts" for 192.168.1.14 at 2016-11-03 04:14:19 -0500
2016-11-03 04:14:19 ac50fd30 [app] [F] 
 | ActionController::RoutingError (No route matches [GET] "/hosts/***********.com/parent_facts/db2::Install::10.1/facts"):
 |   lib/middleware/tagged_logging.rb:18:in `call'
 | 
 |

Foreman 1.13.1 all in one RHEL 7.2

#2 Updated by Gheorghe Nedelcu over 3 years ago

I found that fact key using the "dot" is the wrong character in my case.
10.1 => {}

#3 Updated by Dominic Cleal about 3 years ago

  • Category changed from Web Interface to Facts

#4 Updated by James Perry about 3 years ago

Could this be tied into the what the APIv2 is returning when queried for facts? When I run https://puppet/api/myhost.mydomain.com/facts I see the first values are:

{...
"disks::sda":null,
"mountpoints":null,
"partitions":null
...
}

When running https://puppet/api/myhost.mydomain.com/facts?per_page=1000 I see the same at the top, then I get

"partitions::/dev/sda1::size":"101.94 MiB",
"partitions::/dev/sda1::size_bytes":"106896384",
"partitions::/dev/sda1::mount":"/boot",
"partitions::/dev/sda1::label":"/boot"
"partitions::/dev/sda1::filesystem":"ext3"

So the information is here. Could it be related to it getting a "null" and then stopping to retrieve the data at that point? What module handles this parsing so I could try to trace it out to see why it is breaking?

#5 Updated by James Perry about 3 years ago

I also ran a more detailed search against /usr with https://dlistmrfpup02.cbs.ad.cbs.net/api/hosts/myhost.com/facts?search=/usr. It has all of the relevant data. So it is broken somewhere between the API calls and the module rendering it for the facts page in Foreman at the point where the mountpoints are listed, but fail the expansion.

{
"total": 380,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": "/usr host = tlistmroel59.cbs.ad.cbs.net",
"sort": {
"by": null,
"order": null
},
"results": {"myhost.com":{"mountpoints::/usr":null,"mountpoints::/usr::used":"1.31 GiB","mountpoints::/usr::used_bytes":"1411076096","mountpoints::/usr::available":"1.99 GiB","mountpoints::/usr::available_bytes":"2131718144","mountpoints::/usr::size":"3.30 GiB","mountpoints::/usr::size_bytes":"3542794240","mountpoints::/usr::capacity":"39.83%","mountpoints::/usr::device":"/dev/mapper/VolGroup00-usr","mountpoints::/usr::filesystem":"ext3","mountpoints::/usr::options":"[\"rw\"]","path":"/sbin:/usr/sbin:/bin:/usr/bin"}}
}

#6 Updated by James Perry almost 3 years ago

Any updates on this bug or workarounds? I find it is still present in 1.14.3.

#7 Updated by Tomer Brisker about 1 year ago

  • Has duplicate Bug #24774: Missing routes when checking facts containing '/' added

#8 Updated by Ewoud Kohl van Wijngaarden about 1 year ago

  • Triaged changed from No to Yes
  • Found in Releases 1.19.1 added

#9 Updated by Ewoud Kohl van Wijngaarden 12 months ago

  • Related to Bug #25296: Viewing Ansible fact causes errors added

#10 Updated by Ewoud Kohl van Wijngaarden 12 months ago

  • Related to deleted (Bug #25296: Viewing Ansible fact causes errors)

#11 Updated by Ewoud Kohl van Wijngaarden 12 months ago

  • Has duplicate Bug #25296: Viewing Ansible fact causes errors added

#12 Updated by Ewoud Kohl van Wijngaarden 12 months ago

  • Has duplicate Bug #25807: Error viewing external structured puppet fact added

#13 Updated by Marcel Kühlhorn 11 months ago

  • Found in Releases 1.21.2 added

#14 Updated by Marek Hulán 8 months ago

  • Related to Feature #26852: Add mountpoint and partition exclude fact patterns added

#15 Updated by The Foreman Bot 8 months ago

  • Assignee set to Marek Hulán
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6950 added

#16 Updated by The Foreman Bot 7 months ago

  • Pull request https://github.com/theforeman/foreman/pull/7005 added

#17 Updated by The Foreman Bot 7 months ago

  • Fixed in Releases 1.24.0 added

#18 Updated by Tomer Brisker 7 months ago

  • Assignee changed from Marek Hulán to Timo Goebel
  • Pull request deleted (https://github.com/theforeman/foreman/pull/6950)

#19 Updated by Timo Goebel 7 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF