Sha256: 0a7a1facc7e06d18765384d27d86570c429ec9dae2e713a2c9dbcbaf8482b7b0

Contents?: true

Size: 1.01 KB

Versions: 24

Compression:

Stored size: 1.01 KB

Contents

module Actions
  module Katello
    module Provider
      class Update < Actions::EntryAction
        def plan(provider, params)
          action_subject(provider)

          update_url(provider, params[:redhat_repository_url]) if params[:redhat_repository_url]
        end

        def humanized_name
          _("Update")
        end

        private

        def update_url(provider, base_url)
          provider.update_attributes!(:repository_url => base_url)

          if provider.redhat_provider?
            provider.products.enabled.each do |product|
              update_repository_urls(product)
            end
          end
        end

        def update_repository_urls(product)
          product.repositories.where(:library_instance_id => nil).each do |repository|
            next unless repository.url
            root = repository.root
            url = root.repo_mapper.feed_url
            plan_action(::Actions::Katello::Repository::Update, root, :url => url)
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
katello-3.13.0 app/lib/actions/katello/provider/update.rb
katello-3.13.0.rc2.1 app/lib/actions/katello/provider/update.rb
katello-3.13.0.rc2 app/lib/actions/katello/provider/update.rb
katello-3.13.0.rc1 app/lib/actions/katello/provider/update.rb