Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1981401

Summary: [pulp3] CV with filter by id with empty rules fails with undefined method `start_date' for nil:NilClass
Product: Red Hat Satellite Reporter: Peter Vreman <peter.vreman>
Component: Content ViewsAssignee: James Jeffers <jjeffers>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: jjeffers, mdellweg, pcreech
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-4.1.1.8-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:12:32 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:    
Bug Blocks: 1957813    

Description Peter Vreman 2021-07-12 13:44:21 UTC
Description of problem:
~~~
2021-07-12T13:40:03 [I|bac|] Task {label: Actions::Katello::ContentView::Publish, id: d1191436-11dc-4359-b59c-3e56cfabd46c, execution_plan_id: 7f4e15a8-bcbb-48a5-be9a-8d27932b9086} state changed: running
2021-07-12T13:40:03 [E|bac|] undefined method `start_date' for nil:NilClass (NoMethodError)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/models/katello/content_view_erratum_filter.rb:96:in `errata_from'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/models/katello/content_view_erratum_filter.rb:36:in `content_unit_pulp_ids'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:268:in `block (2 levels) in add_filter_content'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:267:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:267:in `block in add_filter_content'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:265:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:265:in `add_filter_content'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:327:in `block in copy_content_from_mapping'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:319:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/services/katello/pulp3/repository/yum.rb:319:in `copy_content_from_mapping'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/lib/actions/pulp3/repository/multi_copy_content.rb:23:in `invoke_external_task'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/action/polling.rb:84:in `initiate_external_action'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/action/polling.rb:19:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/action/cancellable.rb:14:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.29/app/lib/actions/pulp3/abstract_async_task.rb:10:in `run'
~~~

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


How reproducible:


Steps to Reproduce:
1. Create CV with a RedHat repo
2. Add CV Errata Filter by ID
3. Leave the ID list (and date and time also) empty
4. Publish CV

Actual results:
Failure

Expected results:
Success

Additional info:
Another bug is that the UI show in the next step and when editing later in the 'Add' Tab the Date/Time section which is incorrect because that shall be only for the 'Erratum by Date and Type'

Comment 1 Peter Vreman 2021-07-12 14:08:47 UTC
Patch is simple, in generate_clauses() the case of empty rules is handled, but this was forgotten in content_unit_pulp_ids():

~~~
--- models/katello/content_view_erratum_filter.rb.210702-1      2021-06-03 15:05:14.000000000 +0000
+++ models/katello/content_view_erratum_filter.rb       2021-07-12 14:06:48.596501188 +0000
@@ -27,6 +27,8 @@
     end

     def content_unit_pulp_ids(repo)
+      return [] if erratum_rules.blank?
+
       if filter_by_id?
         errata_ids = erratum_rules.map(&:errata_id)
         errata_pulp_ids = errata_package_pulp_ids_from_errata_ids(repo, errata_ids)
~~~

Comment 2 Brad Buckingham 2021-07-16 19:01:31 UTC
*** Bug 1978588 has been marked as a duplicate of this bug. ***

Comment 3 James Jeffers 2021-08-04 17:38:32 UTC
Created redmine issue https://projects.theforeman.org/issues/33213 from this bug

Comment 4 Brad Buckingham 2021-08-05 17:56:27 UTC
Upstream PR merged.

Comment 7 Lai 2021-08-17 19:35:25 UTC
Steps to test

1. Create CV with a RedHat repo
2. Add CV Errata Filter by ID
3. Leave the ID list (and date and time also) empty
4. Publish CV with the empty filter

Expected
Should be able to publish successfully

Actual
published successfully

Verified on 6.10 snap 13 with tfm-rubygem-katello-4.1.1.8-1.el7sat.noarch

Comment 10 errata-xmlrpc 2021-11-16 14:12:32 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 (Moderate: Satellite 6.10 Release), 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-2021:4702