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 1342528

Summary: [upgrade] Capsule sync failed with error: undefined method `[]' for nil:NilClass (NoMethodError)
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: UpgradesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, ehelms, jsherril
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/15292
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.42-2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:38:51 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:
Bug Depends On:    
Bug Blocks: 1335807, 1342490    

Description Sachin Ghai 2016-06-03 12:26:31 UTC
Description of problem:
I was trying to perform capsule sync from upgrade satellite from 6.1.9 -> 6.2 snap14.1 and it failed with error:

2016-06-03 08:16:36 [app] [I] Started POST "/katello/api/capsules/2/content/sync" for ::1 at 2016-06-03 08:16:36 -0400
2016-06-03 08:16:36 [app] [I] Processing by Katello::Api::V2::CapsuleContentController#sync as JSON
2016-06-03 08:16:36 [app] [I]   Parameters: {"api_version"=>"v2", "id"=>"2", "capsule_content"=>{}}
2016-06-03 08:16:36 [app] [I] Authorized user admin(Admin User)
2016-06-03 08:16:37 [app] [I] Started GET "/foreman_tasks/tasks/f5dd6601-e230-4f35-9a15-f90e57ed3e4c" for 10.65.223.218 at 2016-06-03 08:16:37 -0400
2016-06-03 08:16:37 [app] [I] Processing by ForemanTasks::TasksController#show as HTML
2016-06-03 08:16:37 [app] [I]   Parameters: {"id"=>"f5dd6601-e230-4f35-9a15-f90e57ed3e4c"}
2016-06-03 08:16:37 [foreman-tasks/action] [E] undefined method `[]' for nil:NilClass (NoMethodError)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.42/app/lib/actions/katello/capsule_content/sync.rb:84:in `block in repos_needing_importer_updates'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.42/app/lib/actions/katello/capsule_content/sync.rb:81:in `select'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.42/app/lib/actions/katello/capsule_content/sync.rb:81:in `repos_needing_importer_updates'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.42/app/lib/actions/katello/capsule_content/sync.rb:64:in `repos_needing_updates'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.42/app/lib/actions/katello/capsule_content/sync.rb:22:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:461:in `block (3 levels) in execute_plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:34:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:34:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/world.rb:30:in `execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:460:in `block (2 levels) in execute_plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in `switch_flow'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:364:in `concurrence'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:459:in `block in execute_plan'


Please note that satellite upgrade was completed successfully and capsule upgrade too if we specify "--pulp-oauth-secret" with installer.

Upgrading...
Upgrade Step: stop_services...
Upgrade Step: start_databases...
Upgrade Step: update_http_conf...
Upgrade Step: migrate_pulp...
Upgrade Step: fix_pulp_httpd_conf...
Upgrade Step: start_httpd...
Upgrade Step: start_qpidd...
Upgrade Step: start_pulp...
Upgrade Step: remove_nodes_importers...
Upgrade Step: Running installer...
Installing             Done                                               [100%] [..................................................................]
  The full log is at /var/log/foreman-installer/capsule.log
Upgrade Step: restart_services...
Katello upgrade completed!


Version-Release number of selected component (if applicable):
upgraded setup from 6.1.9 -> 6.2 GA snap14.1

How reproducible:


Steps to Reproduce:
1. capsule sync
2.
3.

Actual results:
~]# hammer -u admin -p changeme capsule content synchronize --id=2
Could not synchronize capsule content:
  undefined method `[]' for nil:NilClass


Expected results:
sync should work

Additional info:

Comment 2 Justin Sherrill 2016-06-03 18:28:56 UTC
Created redmine issue http://projects.theforeman.org/issues/15292 from this bug

Comment 3 Bryan Kearney 2016-06-07 00:16:06 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15292 has been closed

Comment 4 Sachin Ghai 2016-06-10 09:11:37 UTC
Verified with upgrade from sat6.1.9 -> sat6.2 GA snap15.1

I created a new repo on upgrade satellite and published it in CV. Later initiated the capsule sync. Sync was completed successfully. 

 ~]# hammer -u admin -p changeme capsule content synchronize --id=2
[......................................................................................................................................] [100%]
[root@qe-sat6-upgrade-rhel7 ~]# 

on capsule node, I can see synced custom contents.

# ll | wc -l
165
[root@qe-capsule-rhel7 capsule7]# pwd
/var/lib/pulp/published/yum/https/repos/Default_Organization/DEV/rhel7_cv/custom/capsule/capsule7

Comment 5 Bryan Kearney 2016-07-27 11:38:51 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-2016:1501