Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1642088

Summary: Upgrade from 6.3.4 to 6.4 is failing on foreman-rake katello:import_subscriptions
Product: Red Hat Satellite Reporter: Stefan Nemeth <snemeth>
Component: CandlepinAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.4CC: aperotti, egolov, jsherril, ktordeur, mmccune, pcreech, rbertolj
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.10.0-0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1646739 (view as bug list) Environment:
Last Closed: 2019-05-14 12:38:26 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 (not final fix)
none
Full patch none

Description Stefan Nemeth 2018-10-23 15:09:35 UTC
Description of problem:

Upgrading from 6.3.4 to 6.4 fails on 


/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/lib/katello/resources/candlepin/product.rb:13:in `block in find_for_stacking_id'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/lib/katello/resources/candlepin/product.rb:12:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/lib/katello/resources/candlepin/product.rb:12:in `find_for_stacking_id'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/models/katello/glue/candlepin/pool.rb:48:in `stacking_subscription'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/models/katello/glue/candlepin/pool.rb:104:in `import_data'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/models/katello/glue/candlepin/candlepin_object.rb:44:in `block (2 levels) in import_all'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/models/katello/glue/candlepin/candlepin_object.rb:42:in `block in import_all'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/app/models/katello/glue/candlepin/candlepin_object.rb:38:in `import_all'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41/lib/katello/tasks/import_subscriptions.rake:6:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => katello:import_subscriptions
(See full trace by running task with --trace)
Importing Subscriptions
foreman-rake katello:import_subscriptions failed! Check the output for error!
Upgrade step set_upstream_pool_id failed. Check logs for more information.

Running foreman-rake console command Katello::Pool.import_all fails on 


irb(main):003:0> Katello::Pool.import_all
NoMethodError: undefined method `[]' for nil:NilClass
        from katello (3.7.0.41) app/lib/katello/resources/candlepin/product.rb:13:in `block in find_for_stacking_id'
        from katello (3.7.0.41) app/lib/katello/resources/candlepin/product.rb:12:in `each'
        from katello (3.7.0.41) app/lib/katello/resources/candlepin/product.rb:12:in `find_for_stacking_id'
        from katello (3.7.0.41) app/models/katello/glue/candlepin/pool.rb:48:in `stacking_subscription'
        from katello (3.7.0.41) app/models/katello/glue/candlepin/pool.rb:104:in `import_data'
        from katello (3.7.0.41) app/models/katello/glue/candlepin/candlepin_object.rb:44:in `block (2 levels) in import_all'
        from katello (3.7.0.41) app/models/katello/glue/candlepin/candlepin_object.rb:42:in `block in import_all'
        from katello (3.7.0.41) app/models/katello/glue/candlepin/candlepin_object.rb:38:in `import_all'
        from (irb):3
        from lib/tasks/console.rake:5:in `block in <top (required)>'

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


How reproducible:

100%

Steps to Reproduce:

attempt upgrade from 6.3.4 to 6.4

or 

#foreman-rake console

irb> User.current = User.first
irb> Katello::Subscription.import_all
irb> Katello::Pool.import_all 


Actual results:

upgrade or rake command failing

Expected results:

successful upgrade

Additional info:

Comment 2 Justin Sherrill 2018-10-23 15:40:23 UTC
Created attachment 1496723 [details]
Workaround (not final fix)

You can apply with:

cd /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41
patch -p1 < 1642088.patch


restart the installer

Comment 3 Justin Sherrill 2018-10-23 16:14:46 UTC
Created redmine issue https://projects.theforeman.org/issues/25287 from this bug

Comment 4 Justin Sherrill 2018-10-23 16:15:34 UTC
I've discovered the root cause, will upload a more permanent patch momentarily and open an upstream pr.

Comment 5 Justin Sherrill 2018-10-23 16:24:44 UTC
Created attachment 1496740 [details]
Full patch

Comment 6 Justin Sherrill 2018-10-23 16:25:24 UTC
Attached a final patch, to apply:

You can apply with:

cd /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.41
patch -p1 < 7776.patch


restart the installer

Comment 9 Satellite Program 2018-10-23 18:03:14 UTC
Upstream bug assigned to jsherril

Comment 10 Satellite Program 2018-10-23 18:03:17 UTC
Upstream bug assigned to jsherril

Comment 11 Satellite Program 2018-10-26 20:03:08 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25287 has been resolved.

Comment 15 jcallaha 2019-01-18 19:46:55 UTC
Verified in Satellite 6.5.0 Snap 11.

foreman-rake katello:import subscriptions completed without any errors.

-bash-4.2# foreman-rake katello:import_subscriptions
...
Importing Subscriptions
-bash-4.2#

Comment 17 errata-xmlrpc 2019-05-14 12:38:26 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-2019:1222