Sha256: 157b42bf7d6a6c16151b2d5aaa204cead54d114f11dc1c705c08bd8723ad91d9

Contents?: true

Size: 1.31 KB

Versions: 29

Compression:

Stored size: 1.31 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 && 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

29 entries across 29 versions & 1 rubygems

Version Path
katello-3.15.3.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.3 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.1.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.0.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.0 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.0.rc2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.0.rc1.3 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.0.rc1.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.0.rc1.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.15.0.rc1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.14.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.13.4 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.14.0 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.13.3 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.14.0.rc2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.13.2 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.14.0.rc1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake
katello-3.13.1 lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake