Sha256: ace17444c98a40420923800e3a93961abc4ce8dff24bc09ae3c146ebdc93f745

Contents?: true

Size: 1.08 KB

Versions: 50

Compression:

Stored size: 1.08 KB

Contents

namespace :katello do
  namespace :upgrades do
    namespace '3.15' do
      desc "Reindex the is_modular attribute of an rpm"
      task :reindex_rpm_modular, [:input_file] => ["environment"] do
        User.current = User.anonymous_api_admin
        criteria = { :fields => [],
                     :limit => SETTINGS[:katello][:pulp][:bulk_load_size],
                     :skip => 0,
                     :filters => {'is_modular' => {'$eq' => true}}
                   }
        content_type = Katello.pulp_server.extensions.rpm.content_type
        batch = ::Katello::Pulp::PulpContentUnit.pulp_units_batch(criteria, criteria[:limit]) do
          Katello.pulp_server.resources.unit.search(content_type, criteria)
        end
        pulp_modular_ids = batch.map { |response| response.pluck("_id") }.flatten
        db_modular_ids = ::Katello::Rpm.modular.pluck(:pulp_id)
        ::Katello::Rpm.where(pulp_id: db_modular_ids - pulp_modular_ids).update_all(modular: false)
        ::Katello::Rpm.where(pulp_id: pulp_modular_ids - db_modular_ids).update_all(modular: true)
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
katello-3.18.5 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.4 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.3.1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.3 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-4.0.0.rc3 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.2.1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.2 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.17.3 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-4.0.0.rc2 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.1.1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.17.2 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-4.0.0.rc1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.0 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.17.1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.16.2 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.0.rc2.1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.0.rc2 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.17.0 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
katello-3.18.0.rc1 lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake