Bug 1456446
| Summary: | Capsule sync failed w/ error: undefined local variable or method `capsule' for #<Class:0x0000000f0b18a0> (NameError) | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Sachin Ghai <sghai> |
| Component: | Upgrades | Assignee: | Justin Sherrill <jsherril> |
| Status: | CLOSED ERRATA | QA Contact: | Lukas Pramuk <lpramuk> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.2.10 | CC: | bbuckingham, dlezzoum, egolov, inecas, jsherril, lpramuk, mbacovsk, zhunting |
| Target Milestone: | Unspecified | Keywords: | Regression, Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| 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 17:24:19 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: | |||
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. 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)
This is not really upgrade bug as I hit it with not upgraded 6.2.9. edit: I hit it with not upgraded 6.2.10 snap2 Satellite and external 6.2.9 Capsule 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) 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 |
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: