Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1456446 - Capsule sync failed w/ error: undefined local variable or method `capsule' for #<Class:0x0000000f0b18a0> (NameError)
Capsule sync failed w/ error: undefined local variable or method `capsule' fo...
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Upgrades (Show other bugs)
6.2.10
Unspecified Unspecified
unspecified Severity high (vote)
: 6.2.10
: Unused
Assigned To: Justin Sherrill
Lukas Pramuk
: Regression, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-05-29 08:19 EDT by Sachin Ghai
Modified: 2017-06-20 13:24 EDT (History)
8 users (show)

See Also:
Fixed In Version: rubygem-katello-3.0.0.137-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-06-20 13:24:19 EDT
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)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1553 normal SHIPPED_LIVE Satellite 6.2.10 Async Bug Release 2017-06-20 17:19:07 EDT

  None (edit)
Description Sachin Ghai 2017-05-29 08:19:28 EDT
Description of problem:
Upgraded satellite server from 6.2.9 -> 6.2.10 snap2 and kept the capsule at last released version 6.2.9

Later I ran capsule sync and it failed w/ error:

-bash-4.2# hammer -u admin -p changeme capsule content synchronize --id=2
Could not synchronize capsule content:
  undefined local variable or method `capsule' for #<Class:0x0000000f0b18a0>



2017-05-29 08:15:02 b95edd90 [app] [I] Processing by Katello::Api::V2::CapsuleContentController#sync as JSON
2017-05-29 08:15:02 b95edd90 [app] [I]   Parameters: {"api_version"=>"v2", "id"=>"2", "capsule_content"=>{}}
2017-05-29 08:15:02 b95edd90 [app] [I] Authorized user admin(Admin User)
2017-05-29 08:15:02 b95edd90 [foreman-tasks/dynflow] [D] ExecutionPlan 65bc30ab-65a0-4cb0-95bb-57d2f2f67960      pending >>  planning
2017-05-29 08:15:02 b95edd90 [foreman-tasks/dynflow] [D]          Step 65bc30ab-65a0-4cb0-95bb-57d2f2f67960: 1   pending >>   running in phase     Plan Actions::Katello::CapsuleContent::Sync
2017-05-29 08:15:02 b95edd90 [foreman-tasks/action] [E] undefined local variable or method `capsule' for #<Class:0x0000000f0b18a0> (NameError)
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.135/app/models/katello/glue/pulp/repo.rb:64:in `block in needs_importer_updates'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.135/app/models/katello/glue/pulp/repo.rb:63:in `select'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.135/app/models/katello/glue/pulp/repo.rb:63:in `needs_importer_updates'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.135/app/lib/actions/katello/capsule_content/sync.rb:86:in `repos_needing_updates'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.135/app/lib/actions/katello/capsule_content/sync.rb:24:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/action.rb:461:in `block (3 levels) in execute_plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware/stack.rb:26:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware.rb:17:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware.rb:34:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware.rb:17:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware.rb:34:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware/stack.rb:22:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/middleware/world.rb:30:in `execute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/lib/dynflow/action.rb:460:in `block (2 levels) in execute_plan'

Version-Release number of selected component (if applicable):
satellite server upgrade from 6.2.9 -> sat6.2.10 snap2 and capsule at old version 6.2.9

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
capsule sync failed

Expected results:
sync should succeed.

Additional info:
Comment 1 Sachin Ghai 2017-05-29 08:22:26 EDT
Okay, Just confirmed.. issue is not specific to n-1 capsule. If both satellite and capsule are installed w/ same 6.2.10 snap2, still it appears.
Comment 4 Evgeni Golov 2017-05-29 09:06:47 EDT
The following (untested) patch should fix it:

diff --git a/app/models/katello/glue/pulp/repo.rb b/app/models/katello/glue/pulp/repo.rb
index d6ff19d..1f2c71b 100644
--- a/app/models/katello/glue/pulp/repo.rb
+++ b/app/models/katello/glue/pulp/repo.rb
@@ -61,7 +61,7 @@ module Katello
 
         def self.needs_importer_updates(repos, capsule_content)
           repos.select do |repo|
-            repo_details = capsule.pulp_repo_facts(repo.pulp_id)
+            repo_details = capsule_content.pulp_repo_facts(repo.pulp_id)
             next unless repo_details
             capsule_importer = repo_details["importers"][0]
             !repo.importer_matches?(capsule_importer, capsule_content.capsule)
Comment 7 Lukas Pramuk 2017-06-08 12:26:05 EDT
This is not really upgrade bug as I hit it with not upgraded 6.2.9.
Comment 8 Lukas Pramuk 2017-06-08 12:28:36 EDT
edit: I hit it with not upgraded 6.2.10 snap2 Satellite and external 6.2.9 Capsule
Comment 9 Lukas Pramuk 2017-06-08 12:36:27 EDT
VERIFIED.

@satellite-6.2.10-3.0.el7sat.noarch
tfm-rubygem-katello-3.0.0.137-1.el7sat.noarch

# hammer capsule list
---|-----------------|------------------------------|--------------------------
ID | NAME            | URL                          | FEATURES                 
---|-----------------|------------------------------|--------------------------
2  | cap.example.com | https://cap.example.com:9090 | Templates, Pulp Node, ...
1  | sat.example.com | https://sat.example.com:9090 | Pulp, Puppet, Puppet C...
---|-----------------|------------------------------|--------------------------

# hammer capsule content synchronize --id=2
[......................................................................] [100%]

>>> capsule synced just fine (both UI/CLI)
Comment 11 errata-xmlrpc 2017-06-20 13:24:19 EDT
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:1553

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