Sha256: 7bf8b6ca6dd2f7a5ea335db85c37e342ba4f35edf39e164f47a7b55c95082dda

Contents?: true

Size: 1.01 KB

Versions: 3

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, base_url)
            end
          end
        end

        def update_repository_urls(product, base_url)
          product.repositories.each do |repository|
            next unless repository.url
            uri = URI.parse(repository.url)
            url = "#{base_url}#{uri.path}"
            plan_action(::Actions::Katello::Repository::Update, repository, :url => url)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-2.4.0.rc3 app/lib/actions/katello/provider/update.rb
katello-2.4.0.rc2 app/lib/actions/katello/provider/update.rb
katello-2.4.0.rc1 app/lib/actions/katello/provider/update.rb