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 1584656 - ActiveRecord::UnknownAttributeError: unknown attribute 'sourcerpm' for Katello::Srpm.
Summary: ActiveRecord::UnknownAttributeError: unknown attribute 'sourcerpm' for Katell...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.3.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: 6.4.0
Assignee: Stephen Benjamin
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks: 1353215
TreeView+ depends on / blocked
 
Reported: 2018-05-31 11:55 UTC by Kenny Tordeurs
Modified: 2021-12-10 16:16 UTC (History)
6 users (show)

Fixed In Version: tfm-rubygem-katello-3.7.0.11-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:01:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24334 0 Normal Closed ActiveRecord::UnknownAttributeError: unknown attribute 'sourcerpm' for Katello::Srpm. 2019-12-11 17:19:46 UTC

Description Kenny Tordeurs 2018-05-31 11:55:10 UTC
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

Comment 3 Stephen Benjamin 2018-07-20 17:24:07 UTC
Created redmine issue https://projects.theforeman.org/issues/24334 from this bug

Comment 4 Satellite Program 2018-07-20 18:21:06 UTC
Upstream bug assigned to stbenjam

Comment 5 Satellite Program 2018-07-20 18:21:10 UTC
Upstream bug assigned to stbenjam

Comment 6 Satellite Program 2018-07-25 16:21:08 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/24334 has been resolved.

Comment 9 Peter Ondrejka 2018-09-05 14:17:03 UTC
Verified on Satellite 6.4 snap 20 using steps from https://github.com/Katello/katello/pull/7550

Comment 10 Bryan Kearney 2018-10-16 19:01:00 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-2018:2927


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