Bug 996172

Summary: Failed to publish a view after defining a filter with incorrect pkg format (format other than E:V-R)
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: Content ViewsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Jameer Pathan <jpathan>
Severity: medium Docs Contact:
Priority: high    
Version: NightlyCC: bbuckingham
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-04 18:06:50 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 Sachin Ghai 2013-08-12 14:54:47 UTC
Description of problem:
When we define a filter without following the specified format (E:V-R), the filter created successfully but while publishing, UI raised an error.

--
Failed to publish content view 'publish' from definition 'con-def-0812-195450-306'.
undefined method `keys' for [{:term=>{:version=>"01-0.01-1"}}, {:term=>{:release=>"01-1"}}]:Array (NoMethodError) 
--


Version-Release number of selected component (if applicable):
katello-1.4.3-1.git.162.c75fe6b.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. Create a content-view
2. Select any created repo
3. Create a package filter
4. do not follow defined package format
5. Publish the CV

Actual results:
--
Failed to publish content view 'publish' from definition 'con-def-0812-195450-306'.
undefined method `keys' for [{:term=>{:version=>"01-0.01-1"}}, {:term=>{:release=>"01-1"}}]:Array (NoMethodError) 
--

Expected results:
At first place, UI should not allow user to create filter when package format is not appropriate.

If its allowed then the error message raised while publishing the CV should be rephrased.


Additional info:
/usr/share/katello/app/models/glue/elastic_search/package.rb:154:in `block in search'
/usr/share/katello/app/models/glue/elastic_search/package.rb:153:in `each'
/usr/share/katello/app/models/glue/elastic_search/package.rb:153:in `search'
/usr/share/katello/app/models/package_rule.rb:55:in `generate_version_clause'
/usr/share/katello/app/models/package_rule.rb:36:in `block in generate_clauses'
/usr/share/katello/app/models/package_rule.rb:26:in `each'
/usr/share/katello/app/models/package_rule.rb:26:in `each_with_object'
/usr/share/katello/app/models/package_rule.rb:26:in `generate_clauses'
/usr/share/katello/app/models/content_view_definition.rb:296:in `block in generate_clauses'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/relation/delegation.rb:6:in `collect'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/relation/delegation.rb:6:in `collect'
/usr/share/katello/app/models/content_view_definition.rb:295:in `generate_clauses'
/usr/share/katello/app/models/content_view_definition.rb:257:in `unassociation_clauses'
/usr/share/katello/app/models/content_view_definition.rb:146:in `block (2 levels) in unassociate_contents'
/usr/share/katello/app/models/content_view_definition.rb:145:in `each'
/usr/share/katello/app/models/content_view_definition.rb:145:in `block in unassociate_contents'
/usr/share/katello/app/models/content_view_definition.rb:144:in `each'
/usr/share/katello/app/models/content_view_definition.rb:144:in `unassociate_contents'

Comment 1 Sachin Ghai 2013-08-13 09:40:32 UTC
Investigated further and found that the issue is with the type 'only-version'.

When you filter a package of specific version with type 'Only-Version' then UI raised the undefined method error.

Step to reproduce it:

- sync a repo: http://inecas.fedorapeople.org/fakerepos/zoo/
- Create a package filter (include/exclude) for package camel
- select 'only-Version' having value '0.1-1'

Comment 2 RHEL Program Management 2013-09-17 04:19:40 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 5 Sachin Ghai 2013-10-10 10:41:06 UTC
Easily reproducible with snap4 compose4. 

steps to reproduce
1. create a CV and select the repo
2. create filter and associate repo
3. Create a package filter (include/exclude) for any pkg (e.g. camel)
4. select 'only-Version' having value '0.1'
5. publish the cv

Comment 6 Brad Buckingham 2016-08-04 18:06:50 UTC
The code has changed drastically since the issue was initially reported.  Tested this scenario on Satellite 6.2 GA and I was to publish the content view successfully without error. In my test, I used a package exclusion filter and the package was correctly excluded from the published CV.

The following is the status of the publish task:

Id: fc4f117a-b930-40b7-8f8b-422f5b6aec04
Label: Actions::Katello::ContentView::Publish
Name: Publish
Owner: admin
Execution type: Delayed
Start at: 2016-08-04 14:02:42 -0400
Start before: -
Started at: 2016-08-04 14:02:42 -0400
Ended at: 2016-08-04 14:03:12 -0400
State: stopped
Result: success
Params: content view 'zoo'; organization 'Default Organization'

Based on this result, closing this bugzilla.