Sha256: 3714242dde3ce6eeabc5ece29b421d4e93903aac9056266569ccb6863fe9a6a7

Contents?: true

Size: 1.58 KB

Versions: 15

Compression:

Stored size: 1.58 KB

Contents

require File.expand_path("../engine", File.dirname(__FILE__))

namespace :katello do
  desc "Runs a katello ping and prints out the statuses of each service"
  task :check_ping => :environment do
    ::User.current = ::User.anonymous_admin
    ping_results = Katello::Ping.ping
    if ping_results[:status] != "ok"
      pp ping_results
      fail("Not all the services have been started. Check the status report above and try again.")
    end
  end

  desc "Reimports information from backend systems"
  task :reimport => ["environment", "katello:check_ping"] do
    User.current = User.anonymous_admin #set a user for orchestration
    Dir.glob(Katello::Engine.root.to_s + '/app/models/katello/*.rb').each { |file| require file }

    models = [
      Katello::Subscription,
      Katello::Pool,
      Katello::ContentViewPuppetEnvironment,
      Katello::Content
    ]

    Katello::RepositoryTypeManager.repository_types.each_value do |repo_type|
      indexable_types = repo_type.content_types_to_index
      if SmartProxy.pulp_master.pulp3_repository_type_support?(repo_type)
        puts "\e[33mIgnoring types: #{indexable_types&.map { |type| type.model_class.name }}\e[0m\n"
      else
        models += indexable_types&.map(&:model_class)
      end
    end

    models.each do |model|
      print "Importing #{model.name}\n"
      model.import_all
    end

    print "Importing Activation Key Subscriptions\n"
    Katello::ActivationKey.all.each do |ack_key|
      ack_key.import_pools
    end

    print "Importing Linked Repositories"
    Katello::Repository.linked_repositories.each(&:index_content)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
katello-3.16.1.2 lib/katello/tasks/reimport.rake
katello-3.16.1.1 lib/katello/tasks/reimport.rake
katello-3.16.1 lib/katello/tasks/reimport.rake
katello-3.17.0.rc1 lib/katello/tasks/reimport.rake
katello-3.16.0 lib/katello/tasks/reimport.rake
katello-3.16.0.rc5.1 lib/katello/tasks/reimport.rake
katello-3.16.0.rc5 lib/katello/tasks/reimport.rake
katello-3.16.0.rc4.1 lib/katello/tasks/reimport.rake
katello-3.16.0.rc4 lib/katello/tasks/reimport.rake
katello-3.16.0.rc3.1 lib/katello/tasks/reimport.rake
katello-3.16.0.rc3 lib/katello/tasks/reimport.rake
katello-3.16.0.rc2.1 lib/katello/tasks/reimport.rake
katello-3.16.0.rc2 lib/katello/tasks/reimport.rake
katello-3.16.0.rc1.1 lib/katello/tasks/reimport.rake
katello-3.16.0.rc1 lib/katello/tasks/reimport.rake