Bug 1030537

Summary: Don't allow users to add iso repos to content views
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: WebUIAssignee: David Davis <daviddavis>
Status: CLOSED CURRENTRELEASE QA Contact: sthirugn <sthirugn>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.2CC: bbuckingham, cwelton, jmontleo, sthirugn
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7138
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-11 12:20:27 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:

Description Justin Sherrill 2013-11-14 16:15:00 UTC
Description of problem:

If you attempt to publish a content view definition and have added an ISO repo, the publish will fail with an error:

NoMethodError: undefined method `[]' for nil:NilClass


Version-Release number of selected component (if applicable):

mdp2/katello 1.4

How reproducible:
always

Steps to Reproduce: 
1.  Import a manifest 
2.  Enable one or more ISO repos
3.  Create a content view definition
4.  Add at least one ISO repo to the content view definition
5.  Publish the definition to a content view

Actual results:
Error

Expected results:
Publishes correctly

Additional info:

I'm not sure that we should actually support adding ISOs to a CV, if we should then it should work.


2013-10-23T12:47:50-0500: [Worker(delayed_job host:xio99clinuxmgt2.centric.com pid:22368)] ContentViewDefinition#generate_repos failed with NoMethodError: undefined method `[]' for nil:NilClass - 0 failed attempts
2013-10-23T12:47:50-0500: [Worker(delayed_job host:xio99clinuxmgt2.centric.com pid:22368)] PERMANENTLY removing ContentViewDefinition#generate_repos because of 1 consecutive failures.
undefined method `[]' for nil:NilClass
/usr/share/katello/app/models/glue/pulp/repo.rb:677:in `publish_distributor'
/usr/share/katello/app/models/glue/pulp/repo.rb:667:in `generate_metadata'
/usr/share/katello/app/models/repository.rb:242:in `block in trigger_contents_changed'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/associations/collection_proxy.rb:89:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/associations/collection_proxy.rb:89:in `flat_map'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/associations/collection_proxy.rb:89:in `method_missing'
/usr/share/katello/app/models/repository.rb:242:in `trigger_contents_changed'
/usr/share/katello/app/models/content_view_version.rb:186:in `trigger_repository_changes'
/usr/share/katello/app/models/content_view_definition.rb:90:in `generate_repos'
/usr/share/katello/app/models/async_operation.rb:57:in `perform'
/opt/rh/ruby193/root/usr/share/gems/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:94:in `block in invoke_job'
/opt/rh/ruby193/root/usr/share/gems/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize'
/opt/rh/ruby193/root/usr/share/gems/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks'

Comment 2 Brad Buckingham 2014-08-15 16:07:28 UTC
While investigating bug 1129424, had some discussion with Justin and Mike about handling of ISO repos.  For that bug, we have decided that it doesn't make sense to distribute ISO repos to the capsules/nodes.

We also discussed this bug and the decision is that it really doesn't make sense to be add ISO repos to a content view and then publish/promote them.

So to fix this bug, we should at a minimum:
- not include ISO repos in the list of available repos to be added to a content view
- not allow the user to add an ISO repo to a content view

Comment 3 David Davis 2014-08-18 13:19:46 UTC
Looks like we already limit the UI to yum repos so I just need to add a check to the model (for the CLI):

https://github.com/Katello/katello/blob/master/engines/bastion/app/assets/javascripts/bastion/content-views/details/content-view-available-repositories.controller.js#L40

Comment 4 Partha Aji 2014-08-18 16:03:52 UTC
Created redmine issue http://projects.theforeman.org/issues/7138 from this bug

Comment 5 Bryan Kearney 2014-08-18 22:01:51 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/7138 has been closed
-------------
David Davis
Applied in changeset commit:katello|e1212e9ae8343828d9045f026618c48f0d44b31a.

Comment 8 sthirugn@redhat.com 2014-08-21 15:37:59 UTC
Verified.

* UI - I dont see iso repos in the content-view - add repositories page
* CLI 0- Throws proper message when trying to add iso or puppet repos

repoid | reponame
155 | Red Hat Enterprise Linux 6 Server ISOs i386 6.5
142 | Red Hat Enterprise Linux 6 Server ISOs x86_64 6.5 
1   | Red Hat Enterprise Linux 6 Server Kickstart i386 6Server 
4   | Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server
152 | Red Hat Enterprise Linux 7 Server - Supplementary ISOs x86_64 7.0 
78  | testrepo1

hammer> content-view add-repository --id=20 --repository-id=155
Could not add repository:
  Validation failed: Cannot add file repositories to a content view.

hammer> content-view add-repository --id=20 --repository-id=142
Could not add repository:
  Validation failed: Cannot add file repositories to a content view.

hammer> content-view add-repository --id=20 --repository-id=1
The repository has been associated

hammer> content-view add-repository --id=20 --repository-id=4
The repository has been associated

hammer> content-view add-repository --id=20 --repository-id=152
Could not add repository:
  Validation failed: Cannot add file repositories to a content view.

hammer> content-view add-repository --id=20 --repository-id=78
Could not add repository:
  Validation failed: Cannot add puppet repositories to a content view.

Comment 9 Bryan Kearney 2014-09-11 12:20:27 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.