Project

General

Custom queries

Profile

Actions

Bug #16818

closed

nested facts can lead to invalid links

Added by Ohad Levy over 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
-
Difficulty:
Triaged:
Yes
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 4 (0 open4 closed)

Related to Foreman - Feature #26852: Add mountpoint and partition exclude fact patternsClosedLukas ZapletalActions
Has duplicate Foreman - Bug #24774: Missing routes when checking facts containing '/'DuplicateActions
Has duplicate Ansible - Bug #25296: Viewing Ansible fact causes errorsDuplicateActions
Has duplicate Foreman - Bug #25807: Error viewing external structured puppet factDuplicateActions
Actions #1

Updated by Gheorghe Nedelcu over 8 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

Actions #2

Updated by Gheorghe Nedelcu over 8 years ago

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

Actions #4

Updated by James Perry over 8 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?

Actions #5

Updated by James Perry over 8 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"}}
}
Actions #6

Updated by James Perry almost 8 years ago

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

Actions #19

Updated by Timo Goebel over 5 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF