Sha256: d5cb71ddaf0128df6d711ae8f166c8b7b413a12b191057bd49bace87065130bb

Contents?: true

Size: 1.49 KB

Versions: 41

Compression:

Stored size: 1.49 KB

Contents

namespace :katello do
  namespace :upgrades do
    namespace '3.16' do
      desc <<-DESCRIPTION
      Update the applicability calculations for Rhel8 hosts.
      This migration is to be run to address -> https://bugzilla.redhat.com/show_bug.cgi?id=1814095
      DESCRIPTION
      task :update_applicable_el8_hosts, [:input_file] => ["environment"] do
        User.current = User.anonymous_api_admin

        # Find me only those hosts that follow ALL the conditions below
        # 1) Have a module stream enabled.
        # 2) Bound to Non Library repositories. (i.e must belong to a CV thats not the default)
        # 3) Bound repositories must have module streams in them
        hosts = Host.joins(:content_facet => :content_facet_repositories).
                 where("#{Host.table_name}.id" => ::Katello::HostAvailableModuleStream.enabled.select(:host_id)).
                 where("#{Katello::ContentFacetRepository.table_name}.repository_id" =>
                        ::Katello::Repository.joins(:repository_module_streams).
                                          in_non_default_view.
                                          non_archived)
        hosts.each do |host|
          available_streams = ::Katello::HostAvailableModuleStream.joins(:available_module_stream).
                                                enabled.where(:host_id => host).select(:name, :stream)
          ::Actions::Katello::Host::UploadProfiles.upload_modules_to_pulp(available_streams, host)
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
katello-3.16.0.rc1.1 lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake