Bug 1392997
| Summary: | uploading a repo to custom product and showing its details raises NoMethodError: undefined method `+' for nil:NilClass | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Pavel Moravec <pmoravec> |
| Component: | Pulp | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED DUPLICATE | QA Contact: | Katello QA List <katello-qa-list> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.2.4 | CC: | bbuckingham, jcallaha |
| Target Milestone: | Unspecified | ||
| Target Release: | Unused | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-08 20:15:13 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: | 1404695 | ||
| Bug Blocks: | |||
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 *** |
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' ..