Sha256: c4b9aeac4df573f86693ce4f23eb3e0de039c444d72d0355e1dcb66c5280291f

Contents?: true

Size: 1.3 KB

Versions: 35

Compression:

Stored size: 1.3 KB

Contents

namespace :katello do
  namespace :upgrades do
    namespace '3.10' do
      desc "Update repositories with API V1 GPG URLs"
      task :update_gpg_key_urls => ["environment", "katello:check_ping"] do
        User.current = User.anonymous_admin

        ::Organization.all.each do |org|
          org_contents = Katello::Resources::Candlepin::Content.all(org.label, include_only: [:id, :gpgUrl])

          org_contents.each do |cp_content|
            gpg_url = cp_content['gpgUrl']
            if gpg_url&.match(/katello\/api\/repositories/)
              content = Katello::Content.where(cp_content_id: cp_content['id'], organization: org).first

              if content.nil?
                Rails.logger.warn("Candlepin Content id=#{cp_content['id']} isn't in our DB. Try running 'rake katello:reimport' first.")
              else
                root_repo = Katello::RootRepository.in_organization(org).where(content_id: content.cp_content_id).first
                new_gpg_url = root_repo.library_instance.yum_gpg_key_url
                cp_content['gpgUrl'] = new_gpg_url
                Katello::Resources::Candlepin::Content.update(org.label, cp_content)
                content.gpg_url = new_gpg_url
                content.save!
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
katello-3.18.5 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.4 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.3.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.3 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.2.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.17.3 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.1.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.17.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.0 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.17.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.16.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.0.rc2.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.0.rc2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.17.0 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.18.0.rc1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.17.0.rc2.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.17.0.rc2.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.16.1.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake