Project

General

Profile

Actions

Bug #35953

closed

Unable to change download_policy to on_demand if the Red Hat Repository has any checksum_type set in Satellite

Added by Samir Jha about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Repositories
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

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):

Katello 4.3 onwards

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

  1. 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 ).
Actions

Also available in: Atom PDF