Bug 1580436

Summary: subscriptions pages/api errors with 'NoMethodError: undefined method `id' for nil:NilClass'
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: Subscription ManagementAssignee: Stephen Benjamin <stbenjam>
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.1CC: ajambhul, akarimi, arunas.vaznevicius, dmoessne, hshukla, jason.berry, jsherril, okhatavk, pcreech, sghai, slutade, smajumda, suarora, tbhowmik
Target Milestone: 6.4.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.7.0.rc1.2-0.1.rc1.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 19:15:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
workaround.patch none

Description Justin Sherrill 2018-05-21 13:03:29 UTC
Description of problem:

Customer reported, after upgrade to 6.3.1, his subscription pages erroring with:


2018-05-18 21:00:18 d0f6c16b [app] [I] Started GET "/api/v2/hosts?organization_id=3&amp;page=1&amp;paged=true&amp;per_page=50&amp;search=&amp;sort_by=name&amp;sort_order=ASC" for
2018-05-18 21:00:18 7d017c23 [app] [I]   Rendered home/_submenu.html.erb (0.9ms)
2018-05-18 21:00:18 7d017c23 [app] [I]   Rendered home/_user_dropdown.html.erb (2.0ms)
2018-05-18 21:00:18 7d017c23 [app] [I] Read fragment views/tabs_and_title_records-4 (0.1ms)
2018-05-18 21:00:18 d0f6c16b [app] [I] Processing by Api::V2::HostsController#index as JSON
2018-05-18 21:00:18 d0f6c16b [app] [I]   Parameters: {"organization_id"=&gt;"3", "page"=&gt;"1", "paged"=&gt;"true", "per_page"=&gt;"50", "search"=&gt;"", "sort_by"=&gt;"name", "sort_order"=&gt;
"ASC", "apiv"=&gt;"v2"}
2018-05-18 21:00:18 7d017c23 [app] [I]   Rendered home/_organization_dropdown.html.erb (2.9ms)
2018-05-18 21:00:18 d0f6c16b [app] [I] Current user: berj02 (administrator)
2018-05-18 21:00:18 d0f6c16b [app] [I] Expire fragment views/tabs_and_title_records-4 (0.1ms)

2018-05-18 21:00:38 d706e273 [app] [E] NoMethodError: undefined method `id' for nil:NilClass
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/app/views/katello/api/v2/subscriptions/base.json.rabl:22:in `block in eval_source'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/builder.rb:152:in `node'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/builder.rb:114:in `block in compile_settings'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/builder.rb:113:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/builder.rb:113:in `compile_settings'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/builder.rb:58:in `block in to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/builder.rb:248:in `cache_results'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/builder.rb:49:in `to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/engine.rb:86:in `to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/engine.rb:48:in `block in render'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/engine.rb:382:in `cache_results'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.12.0/lib/rabl/engine.rb:47:in `render'


Version-Release number of selected component (if applicable):
6.3.1.1

How reproducible:
Unknown

Comment 1 Justin Sherrill 2018-05-21 13:09:05 UTC
Temporary Workaround:

Apply the included workaround.patch, restart httpd.  This will stop returning the 'hypervisor' information for the subscriptions that are erroring.  This will allow the user to still access the relevant pages until a proper fix can be done.

Comment 2 Justin Sherrill 2018-05-21 13:09:36 UTC
Created attachment 1439613 [details]
workaround.patch

Comment 4 Stephen Benjamin 2018-06-05 19:11:23 UTC
Created redmine issue http://projects.theforeman.org/issues/23823 from this bug

Comment 5 Satellite Program 2018-06-05 20:17:16 UTC
Upstream bug assigned to stbenjam

Comment 6 Satellite Program 2018-06-05 20:17:19 UTC
Upstream bug assigned to stbenjam

Comment 7 Brad Buckingham 2018-06-14 21:32:43 UTC
Moving to POST as the upstream issue has been merged and issue closed.

Comment 10 Jitendra Yejare 2018-09-07 12:02:31 UTC
@Justin,

Need steps to repro/Verify this bug. Is it required to have virt-who subscription in manifest ?

Comment 11 Stephen Benjamin 2018-09-07 12:55:06 UTC
We do not know how the original customer got into this state, I believe a no-break test would just be fine: set up virt who and some VDC subs.

The only other way is to manually assign a hypervisor id that doesn't exist to a pool, overriding any rails validations.

Comment 12 Jitendra Yejare 2018-09-19 12:02:42 UTC
Verified!

@ Satellite 6.4 snap 22

Steps:

1. Import manifest with VDC Subscriptions.
2. Register virt-who clients to the satellite and add the virt-who subscriptions to the clients.
3, Upgrade Satellite 6.3 to 6.4
4. Verify the subscription page and virt-who clients.


Observation:
1. The subscription page post upgrade is not errored out and showing the subscriptions correctly with clients.
2. The virt-who clients are intact post upgrade and subscribed.

Comment 13 Bryan Kearney 2018-10-16 19:15:48 UTC
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-2018:2927