Project

General

Profile

Actions

Bug #10632

open

Operation FAILED: No route matches {:controller=>"reports", :host_id=>nil} on login

Added by Jason Frisvold about 9 years ago. Updated about 9 years ago.

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

Description

This is similar (possibly the same issue) as #2164. That was closed since the issue "went away" overnight.

After logging in and being directed to the dashboard, I see the following :

Oops, we're sorry but something went wrong

Warning!
No route matches {:controller=>"reports", :host_id=>nil}

If you feel this is an error with Foreman itself, please open a new issue with Foreman ticketing system, You would probably need to attach the Full trace and relevant log entries.

Back

I can manually change the url to /hosts and access the system. But the dashboard won't respond. If I go to /reports directly, I see what I believe is causing the problem. One of the reports listed has no hostname. If I click on the "Last Report" time, I get the same error as above.

So, it would appear that somehow a reports entry was added without a hostname. That, in turn, causes a route failure because the host_id is nil.

The reporter of ticket #2164 reported that this went away overnight, likely due to the dashboard no longer needing to display that report.. ie, it rolled off the list.

/var/log/foreman/production.log shows this :

2015-05-27 17:20:40 [I] Processing by DashboardController#index as HTML
2015-05-27 17:20:40 [I] Rendered dashboard/_status_widget.html.erb (2.8ms)
2015-05-27 17:20:40 [I] Rendered dashboard/_status_chart_widget.html.erb (1.0ms)
2015-05-27 17:20:40 [I] Rendered dashboard/_reports_widget.html.erb (9.7ms)
2015-05-27 17:20:40 [I] Rendered dashboard/index.html.erb within layouts/application (15.8ms)
2015-05-27 17:20:40 [W] Operation FAILED: No route matches {:controller=>"reports", :host_id=>nil}
2015-05-27 17:20:40 [I] Rendered common/500.html.erb within layouts/application (3.1ms)
2015-05-27 17:20:40 [I] Rendered layouts/base.html.erb (0.9ms)
2015-05-27 17:20:40 [I] Completed 500 Internal Server Error in 85ms (Views: 4.9ms | ActiveRecord: 1.4ms)

No idea what caused this to begin with, though. I had upgraded puppet from 2.7.?? to 3.8.1 and was running puppet agent --test on a number of hosts.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #10627: Monitor -> Reports will show reports for hosts not in the Organization contextClosedDominic Cleal05/27/2015Actions
Actions #1

Updated by Dominic Cleal about 9 years ago

Can you have a look in /var/log/foreman/production.log and see if you can track down when the report was uploaded from the timestamp on /reports?

Also, are you using orgs/locations or restricted user access, or are you an admin in the "Any" contexts?

Actions #2

Updated by Jason Frisvold about 9 years ago

Dominic Cleal wrote:

Can you have a look in /var/log/foreman/production.log and see if you can track down when the report was uploaded from the timestamp on /reports?

Yes, and I see what's happening. Though I don't know how to fix it. Here's an example of what I'm seeing in the logs :

2015-05-28 09:37:02 [I] Processing by Api::V2::HostsController#facts as JSON
2015-05-28 09:37:02 [I] Parameters: {"name"=>"client0", "certname"=>"client0.example.com", "facts"=>"[FILTERED]", "apiv"=>"v2", :host=>{"name"=>"client0", "certname"=>"client0.example.com"}}
2015-05-28 09:37:02 [I] Import facts for 'client0' completed. Added: 0, Updated: 7, Deleted 0 facts
2015-05-28 09:37:02 [W] Saving eth0 NIC for host client0 failed, skipping because:
2015-05-28 09:37:02 [W] IP address has already been taken
2015-05-28 09:37:02 [I] Completed 201 Created in 67ms (Views: 3.2ms | ActiveRecord: 0.0ms)
2015-05-28 09:37:02 [I] Processing by HostsController#externalNodes as YML
2015-05-28 09:37:02 [I] Parameters: {"name"=>"client0.example.com"}
2015-05-28 09:37:02 [I] Rendered text template (0.0ms)
2015-05-28 09:37:02 [I] Completed 200 OK in 51ms (Views: 0.5ms | ActiveRecord: 4.3ms)
2015-05-28 09:37:03 [I] Processing by Api::V2::ReportsController#create as JSON
2015-05-28 09:37:03 [I] Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
2015-05-28 09:37:03 [I] processing report for client0.example.com
2015-05-28 09:37:03 [I] Imported report for client0.example.com in 0.01 seconds
2015-05-28 09:37:03 [I] Completed 201 Created in 173ms (Views: 1.3ms | ActiveRecord: 0.0ms)

The problem appears to be that client0 is reporting a name of client0 instead of client0.example.com. To contrast, here's a "working" client :

2015-05-28 09:43:27 [I] Processing by HostsController#externalNodes as YML
2015-05-28 09:43:27 [I] Parameters: {"name"=>"client1.example.com"}
2015-05-28 09:43:28 [I] Rendered text template (0.0ms)
2015-05-28 09:43:28 [I] Completed 200 OK in 253ms (Views: 0.6ms | ActiveRecord: 8.0ms)
2015-05-28 09:43:30 [I] Processing by Api::V2::HostsController#facts as JSON
2015-05-28 09:43:30 [I] Parameters: {"facts"=>"[FILTERED]", "name"=>"client1.example.com", "certname"=>"client1.example.com", "apiv"=>"v2", :host=>{"name"=>"client1.example.com", "certname"=>"client1.example.com"}}
2015-05-28 09:43:30 [I] Import facts for 'client1.example.com' completed. Added: 0, Updated: 6, Deleted 0 facts
2015-05-28 09:43:30 [I] Completed 201 Created in 82ms (Views: 4.6ms | ActiveRecord: 0.0ms)
2015-05-28 09:43:30 [I] Processing by HostsController#externalNodes as YML
2015-05-28 09:43:30 [I] Parameters: {"name"=>"client1.example.com"}
2015-05-28 09:43:30 [I] Rendered text template (0.0ms)
2015-05-28 09:43:30 [I] Completed 200 OK in 81ms (Views: 0.5ms | ActiveRecord: 7.5ms)
2015-05-28 09:43:31 [I] Processing by Api::V2::ReportsController#create as JSON
2015-05-28 09:43:31 [I] Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
2015-05-28 09:43:31 [I] processing report for client1.example.com
2015-05-28 09:43:31 [I] Imported report for client1.example.com in 0.01 seconds
2015-05-28 09:43:31 [I] Completed 201 Created in 22ms (Views: 1.3ms | ActiveRecord: 0.0ms)

The client name sent by puppet appears to be the value of the certname parameter in the puppet.conf file. I have a puppet module managing this and that field should be populated by the fqdn. This works the first time puppet runs, but when it's run again, it replaces the fqdn with the short hostname instead, resulting in this problem. I'm not sure how to resolve this. I have several servers that seem to work fine, and several others that experience this problem. I have not been able to identify any differences that would cause this. facter reports the proper fqdn every time I run it on all servers, so I'm a bit confused.

Also, are you using orgs/locations or restricted user access, or are you an admin in the "Any" contexts?

I have access to both. I generally log in as a user and avoid using admin when I can. Don't log in as root and all that.. I have several locations defined and a single org in addition to the Any context.

Actions #3

Updated by Dominic Cleal about 9 years ago

I don't have anything to add to the naming issue, but it seems like the reports/host error issue might stem from #10627. In that ticket, you can see reports without the associated host if that host's in a different org/location to your own, which could be generating the error. This reports ought to be hidden, which would hopefully fix the issue.

It might be that the hosts you're dealing with aren't visible in your current org/location, especially if newly created through facts.

Actions #4

Updated by Dominic Cleal almost 9 years ago

  • Related to Bug #10627: Monitor -> Reports will show reports for hosts not in the Organization context added
Actions

Also available in: Atom PDF