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 2159776 - Unable to change download_policy to on_demand if the Red Hat Repository has any checksum_type set in Satellite
Summary: Unable to change download_policy to on_demand if the Red Hat Repository has a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.11.4
Hardware: All
OS: Unspecified
unspecified
high
Target Milestone: 6.13.0
Assignee: Samir Jha
QA Contact: Cole Higgins
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-10 17:17 UTC by Sayan Das
Modified: 2023-05-03 13:25 UTC (History)
3 users (show)

Fixed In Version: rubygem-katello-4.7.0.5-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2184130 (view as bug list)
Environment:
Last Closed: 2023-05-03 13:24:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35953 0 Normal New Unable to change download_policy to on_demand if the Red Hat Repository has any checksum_type set in Satellite 2023-01-16 14:56:58 UTC
Red Hat Issue Tracker SAT-14900 0 None None None 2023-01-12 15:32:58 UTC
Red Hat Knowledge Base (Solution) 3481621 0 None None None 2023-01-10 17:23:21 UTC
Red Hat Knowledge Base (Solution) 7007695 0 None None None 2023-04-14 06:22:34 UTC
Red Hat Product Errata RHSA-2023:2097 0 None None None 2023-05-03 13:25:03 UTC

Description Sayan Das 2023-01-10 17:17:44 UTC
Description of problem:

Execution of "foreman-rake katello:change_download_policy DOWNLOAD_POLICY=on_demand" or UI action "Content > products > select "Product" > select "repository" > select "Download Policy" > choose on_demand" to change the download policy fails for Red Hat repos if they had "Yum Metadata Checksum" value set to sha1 or sha256 instead of Default.


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

Satellite 6.11 ( basically 6.10 and 6.13 as well )


How reproducible:

Always, when repository download policy is Immediate and checksum_type is set as sha1 or sha256 sum


Steps to Reproduce:
1. Install a Satellite 6.11 and enable a few Red Hat repos.
2. Change their download policy to Immediate and sync them.
3. Use any rake\DB hack to check checksum_type to sha1 or sha256 for any of those repos.
   e.g. it should look like 

# echo "select id,name,download_policy,checksum_type,pulp_scratchpad_checksum_type from katello_root_repositories;" | su - postgres -c "psql foreman"
. id  |                                                  name                                                  | download_policy | checksum_type | pulp_scratchpad_checksum_type
-----+--------------------------------------------------------------------------------------------------------+-----------------+---------------+-------------------------------
   4 | Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server                                      | immediate       | sha256        |
   6 | Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64                                                 | immediate       | sha1          |
  26 | Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server                 | immediate       | sha1          |


4. Now either try executing "foreman-rake katello:change_download_policy DOWNLOAD_POLICY=on_demand" 

   Or, From Ui go to , Content > products > select "Product" > select "repository" > select "Download Policy" > choose on_demand" to change the download policy


Actual results:


2023-01-08T19:05:43 [I|bac|1cffb129] Task {label: , id: f99a7fa6-d705-4da6-8f94-8404f49df7f5, execution_plan_id: b1f66ded-3d58-405e-9326-9c62826b2302} state changed: pending 
2023-01-08T19:05:43 [I|bac|1cffb129] Task {label: Actions::Katello::Repository::Update, id: f99a7fa6-d705-4da6-8f94-8404f49df7f5, execution_plan_id: b1f66ded-3d58-405e-9326-9c62826b2302} state changed: planning 
2023-01-08T19:05:43 [E|bac|1cffb129] Validation failed: Checksum type Checksum type cannot be set for yum repositories with on demand download policy. (ActiveRecord::RecordInvalid)


And no way to change the "checksum_type" value from Satellite UI or hammer.


Expected results:

* We should be able to change the "checksum_type" in an acceptable way via UI or hammer.

* The "katello:change_download_policy" should be improved to handle the unsettling of checksum_type before changing the download_policy.


Additional info:

* This issue can be fixed for any custom repos as Satellite allows changing the checksum_type or "Yum Metadata Checksum" value to "Default" 

* For Red Hat repos, 

  ** From UI, we have no option to edit\set the "Yum Metadata Checksum"

  ** A command like "hammer repository update --id 79 --checksum-type 'sha1' --download-policy immediate" gets successfully executed but cannot set\unset the checksum ( here it's just an example to set sha1 as the value ).

Comment 3 Samir Jha 2023-01-16 14:56:57 UTC
Created redmine issue https://projects.theforeman.org/issues/35953 from this bug

Comment 11 errata-xmlrpc 2023-05-03 13:24:04 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 (Important: Satellite 6.13 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-2023:2097


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