Sha256: 1a06c1ddeb34a0a1fccb74b3f103ecb61a2ed0aeb9c3ce6d7205a5a356d2514c
Contents?: true
Size: 1.03 KB
Versions: 8
Compression:
Stored size: 1.03 KB
Contents
begin require 'rubocop/rake_task' namespace :foreman_scc_manager do desc 'Set up authentication tokens for Katello 4.3.' task :setup_authentication_tokens => ['environment'] do unless ActiveRecord::Base.connection.column_exists?('katello_root_repositories', 'upstream_authentication_token') puts 'Your Katello version needs to be at 4.3 and up to run this task.' return end begin scc_repositories = SccRepository.includes(:scc_katello_repositories).where.not(scc_katello_repositories: { id: nil }) scc_repositories.each do |scc_repo| scc_repo.katello_root_repositories.each do |katello_repo| katello_repo.update!(url: scc_repo.url, upstream_authentication_token: scc_repo.token) end end puts 'Authentication tokens created successfully.' rescue StandardError => e puts 'There was an error while creating the authentication tokens.' puts e.to_s end end end rescue LoadError puts 'Rubocop not loaded.' end
Version data entries
8 entries across 8 versions & 1 rubygems