Sha256: 1d82a3646cb5a103e311e7eefeb606a7b6b4ec52969bac28062285c4cae18519

Contents?: true

Size: 1.12 KB

Versions: 74

Compression:

Stored size: 1.12 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)
          current_base_url = provider.repository_url
          provider.update_attributes!(:repository_url => base_url)

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

        def update_repository_urls(product, current_base_url, new_base_url)
          product.repositories.each do |repository|
            next unless repository.url
            path = repository.url.split(current_base_url)[1]
            url = "#{new_base_url}#{path}"
            plan_action(::Actions::Katello::Repository::Update, repository, :url => url)
          end
        end
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
katello-3.10.2 app/lib/actions/katello/provider/update.rb
katello-3.10.1.1 app/lib/actions/katello/provider/update.rb
katello-3.10.1 app/lib/actions/katello/provider/update.rb
katello-3.10.0 app/lib/actions/katello/provider/update.rb
katello-3.10.0.rc1.1 app/lib/actions/katello/provider/update.rb
katello-3.9.1 app/lib/actions/katello/provider/update.rb
katello-3.10.0.rc1 app/lib/actions/katello/provider/update.rb
katello-3.9.0 app/lib/actions/katello/provider/update.rb
katello-3.8.1 app/lib/actions/katello/provider/update.rb
katello-3.9.0.rc2 app/lib/actions/katello/provider/update.rb
katello-3.9.0.rc1 app/lib/actions/katello/provider/update.rb
katello-3.7.1.1 app/lib/actions/katello/provider/update.rb
katello-3.7.1 app/lib/actions/katello/provider/update.rb
katello-3.8.0 app/lib/actions/katello/provider/update.rb
katello-3.8.0.rc3 app/lib/actions/katello/provider/update.rb
katello-3.8.0.rc2 app/lib/actions/katello/provider/update.rb
katello-3.7.0 app/lib/actions/katello/provider/update.rb
katello-3.8.0.rc1 app/lib/actions/katello/provider/update.rb
katello-3.7.0.rc2 app/lib/actions/katello/provider/update.rb
katello-3.7.0.rc1 app/lib/actions/katello/provider/update.rb