Bug 1584656
| Summary: | ActiveRecord::UnknownAttributeError: unknown attribute 'sourcerpm' for Katello::Srpm. | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Kenny Tordeurs <ktordeur> |
| Component: | Repositories | Assignee: | Stephen Benjamin <stbenjam> |
| Status: | CLOSED ERRATA | QA Contact: | Peter Ondrejka <pondrejk> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.3.1 | CC: | aperotti, arahaman, egolov, inecas, mkearey, mmccune |
| Target Milestone: | 6.4.0 | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | tfm-rubygem-katello-3.7.0.11-1 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-10-16 19:01:00 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: | 1353215 | ||
Created redmine issue https://projects.theforeman.org/issues/24334 from this bug Upstream bug assigned to stbenjam Upstream bug assigned to stbenjam Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/24334 has been resolved. Verified on Satellite 6.4 snap 20 using steps from https://github.com/Katello/katello/pull/7550 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-2018:2927 |
Description of problem: When running `foreman-rake katello:reimport` hitting the following error: ~~~ # foreman-rake katello:reimport Importing Katello::Erratum Importing Katello::PackageGroup Importing Katello::PuppetModule Importing Katello::Rpm Importing Katello::Srpm rake aborted! ActiveRecord::UnknownAttributeError: unknown attribute 'sourcerpm' for Katello::Srpm. /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:59:in `rescue in _assign_attribute' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:53:in `_assign_attribute' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `each' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `assign_attributes' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/srpm.rb:22:in `update_from_json' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:56:in `block (2 levels) in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `block in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/pulp_content_unit.rb:35:in `fetch_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:69:in `import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:36:in `block (3 levels) in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `block (2 levels) in <top (required)>' NoMethodError: undefined method `sourcerpm=' for #<Katello::Srpm:0x00000000bad29938> /opt/rh/rh-ror42/root/usr/share/gems/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:in `method_missing' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:54:in `public_send' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `each' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `assign_attributes' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/srpm.rb:22:in `update_from_json' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:56:in `block (2 levels) in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `block in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/pulp_content_unit.rb:35:in `fetch_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:69:in `import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:36:in `block (3 levels) in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `block (2 levels) in <top (required)>' Tasks: TOP => katello:reimport (See full trace by running task with --trace) ~~~ Version-Release number of selected component (if applicable): 6.3.1* How reproducible: Some customers hit it, could not reproduce it on internal Satellite (yet) Steps to Reproduce: 1. 2. 3. Actual results: # foreman-rake katello:reimport Importing Katello::Erratum Importing Katello::PackageGroup Importing Katello::PuppetModule Importing Katello::Rpm Importing Katello::Srpm rake aborted! ActiveRecord::UnknownAttributeError: unknown attribute 'sourcerpm' for Katello::Srpm. /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:59:in `rescue in _assign_attribute' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:53:in `_assign_attribute' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `each' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `assign_attributes' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/srpm.rb:22:in `update_from_json' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:56:in `block (2 levels) in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `block in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/pulp_content_unit.rb:35:in `fetch_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:69:in `import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:36:in `block (3 levels) in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `block (2 levels) in <top (required)>' NoMethodError: undefined method `sourcerpm=' for #<Katello::Srpm:0x00000000bad29938> /opt/rh/rh-ror42/root/usr/share/gems/gems/activemodel-4.2.6/lib/active_model/attribute_methods.rb:433:in `method_missing' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:54:in `public_send' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `each' /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:35:in `assign_attributes' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/srpm.rb:22:in `update_from_json' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:56:in `block (2 levels) in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:51:in `block in import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/pulp_content_unit.rb:35:in `fetch_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/concerns/pulp_database_unit.rb:69:in `import_all' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:36:in `block (3 levels) in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/lib/katello/tasks/reimport.rake:34:in `block (2 levels) in <top (required)>' Tasks: TOP => katello:reimport (See full trace by running task with --trace) Expected results: Reimport to complete Additional info: This is caused because of a bug in [0] there is the attribute sourcerpm that should not be there: # for i in `locate srpm.rb` ; do grep sourcerpm $i && echo $i ; done ~~~ PULP_INDEXED_FIELDS = %w(name version release arch epoch summary sourcerpm checksum filename _id).freeze /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/srpm.rb ~~~ I believe for you it will be the following file: # vim /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/srpm.rb ~~~ diff -up /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/srpm.rb.bkp /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/srpm.rb --- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/srpm.rb.bkp 2018-05-30 15:51:08.333710843 +0200 +++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/services/katello/pulp/srpm.rb 2018-05-30 15:51:45.655385661 +0200 @@ -4,7 +4,7 @@ module Katello include LazyAccessor PULP_SELECT_FIELDS = %w(name epoch version release arch checksumtype checksum).freeze - PULP_INDEXED_FIELDS = %w(name version release arch epoch summary sourcerpm checksum filename _id).freeze + PULP_INDEXED_FIELDS = %w(name version release arch epoch summary checksum filename _id).freeze CONTENT_TYPE = "srpm".freeze lazy_accessor :pulp_facts, :initializer => :backend_data ~~~ [0] https://github.com/Katello/katello/blob/master/app/services/katello/pulp/srpm.rb#L7