How to change download policy of repositories in Red Hat Satellite 6?

Solution Verified - Updated -


  • Red Hat Satellite 6.3 and above


  • How to change download policy of all enabled repositories in Red Hat Satellite 6?
  • How to change repository download policy to immediate in Red Hat Satellite 6?


  • To change default download policy, follow below steps on Red Hat Satellite WebUI.

    Administer > Settings > Content > Select "Default Repository download policy" > set "immediate"
  • Change download policy of already enabled repository through WebUI.

    Content > products > select "Product" > select "repository" > select "Download Policy" > choose the policy
  • Use the following commands to set download policies for all enabled repositories in Red Hat Satellite 6.

    - Changing download policy to 'immediate'.
    # foreman-rake katello:change_download_policy DOWNLOAD_POLICY=immediate
    - Changing download policy to 'on-demand'.
    # foreman-rake katello:change_download_policy DOWNLOAD_POLICY=on_demand

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.


Tried to update the download policy for all repos to "on demand" but got this error on a lot of repos:

Failed to update repository Red Hat Enterprise Linux 7 Server RPMs x86_64 7.5 (856): Validation failed: Checksum type Checksum type cannot be set for yum repositories with on demand download policy.

How to solve this?

This is tricky: you had to (most probably automatically) set a checksum type to the (katello) repos, which prevents them in changing the policy to On Demand (that newly requires no checksum type, dunno why). I think the below rake script can clean the checksum types:

Katello::RootRepository.yum_type.find_each do |root_repo|
  root_repo.transaction do
      if [::Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND, ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND].include?(root_repo.download_policy) && root_repo.url.present? && URI(root_repo.url).scheme == 'file'
        root_repo.update_attribute(:download_policy, ::Runcible::Models::YumImporter::DOWNLOAD_IMMEDIATE)
        root_repo.repositories.each do |repo|
          importer = repo.importers[0]
          config = {
            :download_policy => ::Runcible::Models::YumImporter::DOWNLOAD_IMMEDIATE

          SmartProxy.pulp_master.pulp_api.resources.repository.update_importer(repo.pulp_id, importer[:id], config) if (importer && importer[:id])

      if !root_repo.on_demand? && root_repo.url.present?
        root_repo.update_attribute(:checksum_type, nil)

        root_repo.repositories.each do |repo|
            repo.update_attribute(:saved_checksum_type, nil)

            if repo.find_distributor[:config]&.delete(:checksum_type)
                repo.pulp_id, repo.find_distributor[:id], repo.find_distributor[:config])
          # rubocop:disable HandleExceptions
          rescue RestClient::ResourceNotFound

Save that as a checksum.rake file, and run: cat checksum.rake | foreman-rake console. THEN re-run the katello:change_download_policy rake script again.

I will ask katello engineering to verify if my script is correct (it quite truly mimics one upgrade script), so please hold on until I confirm it correctness.

Thanks for the help Pavel, I took a snapshot of the Satellite server, and run your script. It seems to work correctly. After your script, I could change the download policy of all the repos to "on_demand". Now, the /var/lib/pulp volume is still full: how can I delete the unneeded RPM files from there? I tried running:

# foreman-rake katello:delete_orphaned_content RAILS_ENV=production
# /etc/cron.weekly/pulp-maintenance

But they did not free any disk space. Thanks!!