This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1286659 - 'No route matches' UI error while browsing Satellite after Upgrade.
'No route matches' UI error while browsing Satellite after Upgrade.
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Upgrades (Show other bugs)
6.1.5
Unspecified Unspecified
unspecified Severity high (vote)
: 6.1.5
: --
Assigned To: satellite6-bugs
Katello QA List
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-30 07:33 EST by Jitendra Yejare
Modified: 2017-02-23 14:39 EST (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-15 08:13:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Screenshot Attached. (205.01 KB, image/png)
2015-11-30 07:33 EST, Jitendra Yejare
no flags Details
Satellite Foreman-debug (841.96 KB, application/x-xz)
2015-11-30 09:27 EST, Jitendra Yejare
no flags Details
foreman-debug from Satellite 6.1.5 showing the error (1.90 MB, application/x-xz)
2015-12-01 03:40 EST, Simon Reber
no flags Details
host without org and loc association (61.62 KB, image/png)
2015-12-11 06:34 EST, Sachin Ghai
no flags Details
less than a week old reports associated to host (29.23 KB, image/png)
2015-12-11 06:35 EST, Sachin Ghai
no flags Details
no reports are not visible under Default_org since host was not associated to any org (68.14 KB, image/png)
2015-12-11 06:38 EST, Sachin Ghai
no flags Details

  None (edit)
Description Jitendra Yejare 2015-11-30 07:33:21 EST
Created attachment 1100495 [details]
Screenshot Attached.

Description of problem:
I have upgraded satellite 6.1.4 to 6.1.5 compose 2.
After upgrade I entered credentials to access satellite home page, and it displays an error occupied page saying:

Oops, we're sorry but something went wrong
Error: No route matches {:controller=>"reports", :host_id=>nil}
If you feel this is an error with Satellite 6 itself, please open a new issue with Satellite ticketing system, You would probably need to attach the Full trace and relevant log entries. 


Version-Release number of selected component (if applicable):
Satellite 6.1.5 Compose 2

How reproducible:


Steps to Reproduce:
1. Upgrade Satellite from 6.1.4 to 6.1.5 compose 2 using Redhat Satellite upgrade process documentation.
2. While doing above, do satellite server reboot twice:
      i) After second yum update.
      ii) Exactly Before running 'katello-installer --upgrade'.
3. Also after ii) reboot stop all the service again except mongod.
4. After Upgrade, Browse Satellite from any supported browser.

Actual results:
An error 'Oops, we're sorry but something went wrong
Error: No route matches {:controller=>"reports", :host_id=>nil}' 
displayed.

Expected results:
No errors while accessing Satellite from browser.

Additional info:
Important Note: If I access satellite with component (like products, content_views) name from url then the error mentioned above is not displayed.
e.g. https://<satellite_fqdn>/products
Comment 2 Kedar Bidarkar 2015-11-30 09:21:52 EST
Looking at the keywords "hosts", "reports", wondering if it has something to do with the fix that went in for https://bugzilla.redhat.com/show_bug.cgi?id=1263741

Could these be related? just a guess.
Comment 3 Jitendra Yejare 2015-11-30 09:27 EST
Created attachment 1100513 [details]
Satellite Foreman-debug
Comment 4 Mike McCune 2015-11-30 14:42:00 EST
Jitendra, that foreman-debug appears really old, from 03-NOV-2015, has old package versions and no errors in the log.

Can you get us either host info or a recent foreman-debug?
Comment 5 Jitendra Yejare 2015-12-01 02:33:20 EST
Hi Mike,

I downloaded the attached foreman-debug and Its latest only from 30-Nov-2015.
Still I will share the Host info by Email.
Also the host machine is automation machine(Its openstack instance which having old version available to upgrade to latest) and Hence may not be available for longer time. Will be there until next compose, if not asked to retrigger automation on this compose.

Thanks,
Jitendra
Comment 6 Simon Reber 2015-12-01 03:40 EST
Created attachment 1100770 [details]
foreman-debug from Satellite 6.1.5 showing the error
Comment 7 Simon Reber 2015-12-01 03:46:22 EST
I'm seeing the same problem after updating to Satellite 6.1.5 Compose 2 when actually browsing to <url>/dashboard (which is also default after login).

When manually changing to <url>/hosts or something else it works. Even all other menu options on Monitor are working. Just /dashboard is having difficulties and does show the mentioned error "No route matches {:controller=>"reports", :host_id=>nil}"

Also then again, when selecting "Any Organization" and browsing to /dashboard it works again.

So it seems to be unique to the /dashboard when a specific organization is selected.
Comment 8 Lukas Zapletal 2015-12-07 04:16:29 EST
Simon, Jitendra,

as Kedar pointed out, it looks like this mist be either regresission from https://bugzilla.redhat.com/show_bug.cgi?id=1263741 or misconfiguration.

What user account do you use when you encounter this misbehavior?

Does it have "Admin" global permission (the checkbox)?

What Organizations and Locations is the user assigned to?

Which Roles is it assigned to?

Have you changed any Permissions in that Roles?

Can you create a new user with "Viewer" role and assigned to the Organization you have problems with?
Comment 9 Jitendra Yejare 2015-12-07 06:35:19 EST
@Lukas: Answer to your questions in comment 8:

What user account do you use when you encounter this misbehavior?
admin

Does it have "Admin" global permission (the checkbox)?
Yes

What Organizations and Locations is the user assigned to?
Neither the org nor the location assigned.

Which Roles is it assigned to?
No roles assigned, Admin checkbox is enabled.

Have you changed any Permissions in that Roles?
Nop, never.

Can you create a new user with "Viewer" role and assigned to the Organization you have problems with?
1. Create new user with Viewer role, assigned to default org and default loc.
I observed same issue as $subject.
2. Create new user with Viewer role, assigned to default org and no loc.
I observed same issue as $subject.
3. Create a new user with Viewer role, assigned to no org and no loc.
I can not see issue as $subject.

Note:
The issue in $subject mentioned is for viewing dashboard only. Answers given in this commented are also tested for viewing dashboard only.
Comment 10 Simon Reber 2015-12-07 07:35:46 EST
(In reply to Lukas Zapletal from comment #8)
> Simon, Jitendra,
> 
> as Kedar pointed out, it looks like this mist be either regresission from
> https://bugzilla.redhat.com/show_bug.cgi?id=1263741 or misconfiguration.
> 
> What user account do you use when you encounter this misbehavior?
> 
> Does it have "Admin" global permission (the checkbox)?
> 
> What Organizations and Locations is the user assigned to?
> 
> Which Roles is it assigned to?
> 
> Have you changed any Permissions in that Roles?
> 
> Can you create a new user with "Viewer" role and assigned to the
> Organization you have problems with?
I just updated the system to Satellite 6.1.5 Compose 3 and the problem seems gone since then.

Now running foreman-1.7.2.48-1.el7sat.noarch and the dashboard is correctly shown again.
Comment 11 Jitendra Yejare 2015-12-07 07:48:56 EST
@Simon: Even me upgraded to latest 6.1.5 compose 3. But the problem still persists. 
Also I see this issue as intermittent. You may try once again and it may fail. :(
Comment 12 Simon Reber 2015-12-07 08:02:52 EST
(In reply to Jitendra Yejare from comment #11)
> @Simon: Even me upgraded to latest 6.1.5 compose 3. But the problem still
> persists. 
> Also I see this issue as intermittent. You may try once again and it may
> fail. :(
So far it keeps working. Did the update today morning and was constantly working on Satellite 6. The problem did so far not re-appear also when doing multiple page refresh
Comment 13 Bryan Kearney 2015-12-07 09:43:55 EST
Should we block on this, or should we close this out and ask that it be re-opened if we see it later?
Comment 14 Simon Reber 2015-12-07 10:17:23 EST
(In reply to Bryan Kearney from comment #13)
> Should we block on this, or should we close this out and ask that it be
> re-opened if we see it later?
For me it's solved! But lets hear what Jitendra has to say about that.
Comment 15 Jitendra Yejare 2015-12-07 10:23:34 EST
@BK
I run upgrade for almost many times on compose 2 and 3. And out of that I see this issue 80% times. I think its better to look into this issue possibly soon.

Also Lets wait what Lukas has to say about it !

Thanks,
Jitendra
Comment 16 Jitendra Yejare 2015-12-08 01:20:13 EST
Full Trace from upgraded satellite to 6.1.5 #c3:

ActionController::RoutingError
No route matches {:controller=>"reports", :host_id=>nil}
app/views/dashboard/_reports_widget.html.erb:15:in `block in _app_views_dashboard__reports_widget_html_erb___3314282636115338528_96243880'
app/views/dashboard/_reports_widget.html.erb:13:in `_app_views_dashboard__reports_widget_html_erb___3314282636115338528_96243880'
app/views/dashboard/index.html.erb:8:in `block in _app_views_dashboard_index_html_erb__3595616548605681368_96927300'
app/views/dashboard/index.html.erb:7:in `map'
app/views/dashboard/index.html.erb:7:in `_app_views_dashboard_index_html_erb__3595616548605681368_96927300'
app/controllers/dashboard_controller.rb:6:in `index'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'
Comment 17 Ohad Levy 2015-12-08 02:30:41 EST
can you enable debug and provide the full production logs (not what you see in the UI)? the above error makes little sense atm.
Comment 18 Lukas Zapletal 2015-12-08 06:18:08 EST
Ah it does make some sense! Here is the _reports_widget.html.erb:

      <% events.each do |report| %>
        <tr>
          <td><%= link_to trunc(report.host, 14), host_reports_path(report.host) %></td>
          <td><%= report_event_column(report.applied, "label-info") %></td>
          <td><%= report_event_column(report.restarted, "label-info") %></td>
          <td><%= report_event_column(report.failed, "label-danger") %></td>
          <td><%= report_event_column(report.failed_restarts, "label-warning") %></td>
          <td><%= report_event_column(report.skipped, "label-info") %></td>
          <td><%= report_event_column(report.pending, "label-info") %></td>
        </tr>
      <% end %>

The error comes from host_reports_path(report.host). Apparently, you have a report that does not have any host set, which fails to render. Workaround: Remove the Last Reports widget.

Please run "foreman-rake console" and pastebin output of:

> Report.search_for('reported > "7 days ago"').limit(100).map(&:host)

> Report.search_for('reported > "7 days ago"').limit(100)

> Report.all

> Host.all.map{|h| [h.name, h.mac]}
Comment 19 Lukas Zapletal 2015-12-08 06:32:04 EST
For the record, normally reports without hosts are not allowed, but we have a bug in our codebase which leaves reports without hosts set on host deletion. To fix your instance issue this in the console:

> Report.destroy_all(:host_id => nil)

I don't know what bug this is and if we already fixed it upstream.
Comment 20 Ohad Levy 2015-12-08 06:33:55 EST
I dont think we have an option to create a report without a host id, i would consider thats more around taxonomies(orgs,loc) rather then missing data in the db.
Comment 21 Lukas Zapletal 2015-12-08 07:07:10 EST
I wonder how you managed to create it, can you tell?

In both Satellite 6.0 and 6.1 we have a foreign key and the host_id column cannot be nil:

t.integer  "host_id",     :null => false

has_many :reports, :dependent => :destroy, :foreign_key => :host_id

Well, if you confirm the workaround in the comment 19, let's move this out of the 6.1.5.
Comment 22 Simon Reber 2015-12-08 07:18:45 EST
(In reply to Lukas Zapletal from comment #19)
> For the record, normally reports without hosts are not allowed, but we have
> a bug in our codebase which leaves reports without hosts set on host
> deletion. To fix your instance issue this in the console:
Well I recently created and removed a lot of hosts. So that might be it.
But, I did not create any custom report (all is still based on the default installation) and I'm also wondering why it's gone again with Compose 3
Comment 24 Lukas Zapletal 2015-12-08 10:35:25 EST
Ok that confirms it has something to do with taxonomy.
Comment 28 Lukas Zapletal 2015-12-09 11:30:01 EST
Ok not a blocker IMHO.

I get this error as well, but once I select Any Organization / Any Location in the selector, it works.

Both hosts are not assigned in any organization, therefore dashboard is broken. Workaround is to either work in Any Context or DefOrg context.

Why we see a report visible from the DefaultContext is not clear to me, this needs further investigation. But not part of 6.1.5 imho.

I tried to clear cache and reset permissions on that host for the record.
Comment 29 Daniel Lobato Garcia 2015-12-09 15:15:11 EST
Here's a reproducer and a link to the PR that fixes it.

1) Create a host without any organization (hammer, console, whateveR)
2) Get a report on that host that is less than 1 week old
3) Browse dashboard having as current organization something different to 'Any organization'. It should crash
4) Browse /reports with the same organization scope setting. It should show reports without the host name.

Both 3 and 4 are wrong behaviors. 3 shouldn't crash, it shouldn't show any reports, and 4 shouldn't show any reports either.

A fix for this was merged upstream a long time ago. https://github.com/dLobatog/foreman/commit/9926db4274e2d9d01466676116a9c001f473f1a4 

Here's a pull request that fixes it downstream - https://gitlab.sat.lab.tlv.redhat.com/satellite6/foreman/merge_requests/124
Comment 33 Sachin Ghai 2015-12-11 06:34 EST
Created attachment 1104617 [details]
host without org and loc association
Comment 34 Sachin Ghai 2015-12-11 06:35 EST
Created attachment 1104618 [details]
less than a week old reports associated to host
Comment 35 Sachin Ghai 2015-12-11 06:38 EST
Created attachment 1104619 [details]
no reports are not visible under Default_org since host was not associated to any org
Comment 36 Jitendra Yejare 2015-12-11 06:49:07 EST
I upgraded Satellite from 6.1.4 to 6.1.5 compose 5.
And I dont see the reported issue after logging in Satellite or on Default Org -> Dashboard page for any crash.

The above observation is for both RHEL 67 and RHEL 72.

Also as per the comment from sghai in comment 32 that he followed the repro steps. And It implies that the bug is not anymore reproducible.

Hence changing the status to 'Verified'.
Comment 37 Bryan Kearney 2015-12-15 08:13:36 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:2622

Note You need to log in before you can comment on or make changes to this bug.