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 1392997 - uploading a repo to custom product and showing its details raises NoMethodError: undefined method `+' for nil:NilClass
Summary: uploading a repo to custom product and showing its details raises NoMethodErr...
Keywords:
Status: CLOSED DUPLICATE of bug 1384673
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.2.4
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On: 1404695
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-08 16:22 UTC by Pavel Moravec
Modified: 2020-06-11 13:04 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-08 20:15:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Pavel Moravec 2016-11-08 16:22:59 UTC
Description of problem:
Creating a custom product and repo, uploading any valid RPM to it (even a stored one in pulp) and showing details of the RPM in webui raises

NoMethodError: undefined method `+' for nil:NilClass

error (backtrace below).

The reason is, pulp stores the RPM in units_rpm collection with empty "files" parameter:

mongo pulp_database --eval "DBQuery.shellBatchSize = 100000000; db.units_rpm.find().pretty().shellPrint()" prints:

..
{ "_id" : "7b80490e-19a7-44c0-a514-f4988021f486", "pulp_user_metadata" : {  }, "_last_updated" : 1478619814, .. "filename" : "ipmitool-1.8.13-7.el7.x86_64.rpm" .. "files" : {  }, "repodata" : { "filelists" : "\n<package pkgid=\"3e779fdb01c60c1ef9039f6997d53af9772f814dac218b76318ffe58004ba5db\" name=\"ipmitool\" arch=\"x86_64\">\n  <version epoch=\"0\" ver=\"1.8.13\" rel=\"7.el7\"/>\n  <file>/etc/sysconfig/ipmievd</file>\n  <file>/usr/bin/ipmitool</file>\n ..

Other regularly downloaded packages (i.e. via repo sync) get the "files" populated.

Empty "files" is not expected in katello (that has its own bug, then):

/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.81/app/services/katello/pulp/rpm.rb having:

      def files
        if pulp_facts['files']
          pulp_facts['files']['file'] + pulp_facts['files']['dir']
        else
          []
        end
      end

pulp_facts['files'] exists but is empty :-/



Version-Release number of selected component (if applicable):
Sat 6.2.3
tfm-rubygem-katello-3.0.0.81-1.el7sat.noarch
pulp-server-2.8.7.2-1.el7sat.noarch


How reproducible:
100%


Steps to Reproduce:
1. Create a custom product and custom repo
2. upload some rpm from /var/lib/pulp/content (update repo id and product id accordingly)
hammer -u admin -p redhat repository upload-content --organization-id=1 --id=14 --product-id=164 --path=/var/lib/pulp/content/units/rpm/00/f8999daed44570805fb5573b5979eab00766af32b810ed0ca1727f0776cedd/ipmitool-1.8.13-7.el7.x86_64.rpm

3. In WebUI, go to Content -> Packages -> select the custom repo -> click to the added rpm
4. Get mongo units_rpm collection as above
5. Upload a RPM with really empty files provided by it and repeat 3. and 4.

Actual results:
3. raises below error / backtrace to production.log and that error to webui
4. shows empty "files" in mongo collection
5. raises that error as well


Expected results:
3. webui shows proper data
4. mongo has proper "files" data
5. webui shows really empty info on "Files" tab (well, this can be improved, empty page should be replaced by some human-understandable "no file content" string or so)


Additional info:
Backtrace of the error:

2016-11-08 16:15:12 [app] [E] NoMethodError: undefined method `+' for nil:NilClass
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.81/app/services/katello/pulp/rpm.rb:35:in `files'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/helpers.rb:20:in `data_object_attribute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:140:in `attribute'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:114:in `block in compile_settings'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:113:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:113:in `compile_settings'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:53:in `block in to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:248:in `cache_results'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:49:in `to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:86:in `to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:48:in `block in render'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:382:in `cache_results'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:47:in `render'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:127:in `block in merge_engines_into_result'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:119:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:119:in `merge_engines_into_result'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:55:in `block in to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:248:in `cache_results'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:49:in `to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:86:in `to_hash'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:101:in `to_dumpable'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:110:in `to_json'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:48:in `block in render'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:382:in `cache_results'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:47:in `render'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.81/app/views/katello/api/v2/packages/show.json.rabl:3:in `_4567bff74f9cd1ac0d4abf511284f104'
..

Comment 1 Brad Buckingham 2016-11-08 20:15:13 UTC
Closing this one as a duplicate of bug 1384673, which addresses the katello change to cleanly handle case when 'files' is not available.  There is also a pulp bug 1387766 to handle storing 'files' for uploaded rpms. ; however, there is also a pulp bug to store 'files' for the uploaded rpms.

*** This bug has been marked as a duplicate of bug 1384673 ***


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