Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1387776 - Unable to view activation keys in satellite web-ui as well as in hammer since upgrade
Summary: Unable to view activation keys in satellite web-ui as well as in hammer since...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Activation Keys
Version: 6.2.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks: 1417112
TreeView+ depends on / blocked
 
Reported: 2016-10-21 20:43 UTC by Prashant Waghmare
Modified: 2021-03-11 14:46 UTC (History)
11 users (show)

Fixed In Version: rubygem-katello-3.0.0.98-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1417112 (view as bug list)
Environment:
Last Closed: 2017-03-06 08:29:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 16931 0 Normal Closed better handle pools with missing subscription ids when listing akeys 2020-08-10 13:13:51 UTC
Red Hat Knowledge Base (Article) 2861931 0 None None None 2017-01-16 20:19:15 UTC
Red Hat Product Errata RHBA-2017:0447 0 normal SHIPPED_LIVE Satellite 6.2.8 Async Bug Release 2017-03-06 13:23:41 UTC

Description Prashant Waghmare 2016-10-21 20:43:59 UTC
Description of problem:

Unable to view activation keys in satellite web-ui since upgrade

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

Satellite 6.2.2

How reproducible:

Always

Steps to Reproduce:

1. After upgrade to satellite 6.2 unable to view activation keys

2.$ sudo hammer activation-key list --organization Test
undefined method `products' for nil:NilClass

3.

Actual results:

After upgrade to satellite 6.2 unable to view activation keys

Expected results:

After upgrade to satellite 6.2 should be able to view activation keys

Additional info:

After application of following patch, this issue got resolved, and cu is able to view the activation keys in satellite web-ui

 PR: https://github.com/Katello/katello/pull/6396 which is for patch : https://patch-diff.githubusercontent.com/raw/Katello/katello/pull/6396.patch

# find / -name activation_key.rb | grep katello

then among the out-put you got in above command, select the following path from it:

a) vi /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.*/app/models/katello/activation_key.rb

@@ -98,7 +98,11 @@ def products
       if cp_pools
         pools = cp_pools.collect { |cp_pool| Pool.find_by(:cp_id => cp_pool['id']) }
         pools.each do |pool|
(-)          all_products << pool.subscription.products
(+)          if pool.subscription
(+)            all_products << pool.subscription.products
(+)          else
(+)            Rails.logger.error("Pool #{pool.id} is missing its subscription id.")
(+)          end
         end
       end
       all_products.flatten!

Note: Sign (-) indicates comment the concern line and (+) sign indicates add the concern line.

Comment 2 Bryan Kearney 2016-10-26 16:20:17 UTC
Upstream bug assigned to jsherril

Comment 3 Bryan Kearney 2016-10-26 16:20:20 UTC
Upstream bug assigned to jsherril

Comment 4 Bryan Kearney 2016-10-31 16:20:22 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16931 has been resolved.

Comment 14 Lukas Pramuk 2017-02-01 14:06:19 UTC
What is reproducer here?
I just upgraded 6.1.11 to 6.2.7 and activation-keys remain present.
What kind of AKs it has to be to reproduce?

Comment 15 Andrew Kofink 2017-02-01 15:48:25 UTC
Lukas,

I believe you have to have to have repositories that are no longer supported with a valid subscription (i.e. delete your manifest) on the activation key. Re-flag needinfo if this doesn't work.

Comment 16 Lukas Pramuk 2017-02-08 09:27:51 UTC
Andrew,

yet before the upgrade I deleted a manifest, but still no luck reproducing this issue - AKs after the upgrade are all visible. (I associated 3 AKs to different subs in the manifest - 1 to all, 1 to employee only, 1 to atomic only)

Comment 17 Andrew Kofink 2017-02-08 16:29:07 UTC
Lukas,

I see what you're saying (just tried it on 6.2.7). One way to definitely reproduce this issue is to remove the relationship manually:

```
foreman-rake console
User.current = User.find_by(login: 'admin')
ak = Katello::ActivationKey.find(1)
pools = ak.get_key_pools.collect { |cp_pool| Katello::Pool.find_by(:cp_id => cp_pool['id']) }
pools.first.subscription_id = nil
pools.first.save
```

hammer activation-key list --organization-id 1

Comment 18 Andrew Kofink 2017-02-16 15:34:12 UTC
On 6.1.z, you would need to change the find_by calls to find_by_<field>, like this:

```
foreman-rake console
User.current = User.find_by_login('admin')
ak = Katello::ActivationKey.find(1)
pools = ak.get_key_pools.collect { |cp_pool| Katello::Pool.find_by_cp_id( cp_pool['id']) }
pools.first.subscription_id = nil
pools.first.save
```

Comment 21 Lukas Pramuk 2017-02-20 13:07:44 UTC
VERIFIED.

@satellite-6.2.8-1.0.el7sat.noarch
tfm-rubygem-katello-3.0.0.102-1.el7sat.noarch

by this manual reproducer:

1. @Sat6.2.2 create AK and associate with subscription(s)

# hammer --csv activation-key list --organization-id 1
ID,Name,Host Limit,Lifecycle Environment,Content View                                                                   1,AK_1,0 of Unlimited,Library,CV_1


2. Simulate broken relationship of AK with subscription
# foreman-rake console
...
irb(main):001:0> User.current = User.find_by(login: 'admin')
...
irb(main):002:0> ak = Katello::ActivationKey.find(1)
...
irb(main):003:0> pools = ak.get_key_pools.collect { |cp_pool| Katello::Pool.find_by(:cp_id => cp_pool['id']) }
...
irb(main):004:0> pools.first.subscription_id = nil
=> nil
irb(main):005:0> pools.first.save
=> true


3. Try to list AKs
# hammer activation-key list --organization-id 1 
undefined method `products' for nil:NilClass

@UI: /activation_keys page is now loading forever


4. Upgrade to 6.2.8
# yum upgrade
...
# satellite-installer --upgrade
...
Upgrade completed!

5. List AKs
# hammer --csv activation-key list --organization-id 1
ID,Name,Host Limit,Lifecycle Environment,Content View                                                                   1,AK_1,0 of Unlimited,Library,CV_1

@UI: /activation_keys page loads successfully

Comment 23 errata-xmlrpc 2017-03-06 08:29:45 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/RHBA-2017:0447


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