Sha256: 207ff8c437569fcc3dfd3fef7b964a5fefa5f6f23b11d6b1b61cc843707074db

Contents?: true

Size: 823 Bytes

Versions: 3

Compression:

Stored size: 823 Bytes

Contents

namespace :katello do
  namespace :upgrades do
    namespace '4.3' do
      desc "change urls with username and password in the url to use basic auth parameters in pulp3"
      task :fix_url_auth => ["environment"] do
        User.current = User.anonymous_admin

        Katello::Repository.all.each do |repo|
          upstream_url = repo.root.url
          uri = URI(repo.root.url)
          if uri.userinfo
            user, password = uri.userinfo.split(':')
            upstream_url.slice!(uri.userinfo + "@")
            repo_params = {
              upstream_username: user,
              upstream_password: password,
              url: upstream_url,
            }
            ForemanTasks.sync_task(Actions::Katello::Repository::Update, repo.root, repo_params)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.15.0 lib/katello/tasks/upgrades/4.3/fix_url_auth.rake
katello-4.15.0.rc2 lib/katello/tasks/upgrades/4.3/fix_url_auth.rake
katello-4.15.0.rc1 lib/katello/tasks/upgrades/4.3/fix_url_auth.rake