Sha256: 1ef0dded85a0c5746d7bb0eaf2d222c4d10a8479fb504765b4eceba5f81c7463

Contents?: true

Size: 1.82 KB

Versions: 17

Compression:

Stored size: 1.82 KB

Contents

module Actions
  module Katello
    module Repository
      class Update < Actions::EntryAction
        def plan(root, repo_params)
          repository = root.library_instance
          action_subject root.library_instance

          repo_params[:url] = nil if repo_params[:url] == ''
          root.update_attributes!(repo_params)

          if update_content?(repository)
            content = root.content

            plan_action(::Actions::Candlepin::Product::ContentUpdate,
                        :owner => repository.organization.label,
                        :content_id => root.content_id,
                        :name => content.name,
                        :content_url => root.custom_content_path,
                        :gpg_key_url => repository.yum_gpg_key_url,
                        :label => content.label,
                        :type => root.content_type,
                        :arches => root.arch == "noarch" ? nil : root.arch)

            content.update_attributes!(name: content.name,
                                       content_url: root.custom_content_path,
                                       content_type: repository.content_type,
                                       label: content.label,
                                       gpg_url: repository.yum_gpg_key_url)
          end

          plan_action(::Actions::Pulp::Repository::Refresh, repository) if root.pulp_update_needed?
          plan_self(:repository_id => root.library_instance.id)
        end

        def run
          repository = ::Katello::Repository.find(input[:repository_id])
          ForemanTasks.async_task(Katello::Repository::MetadataGenerate, repository)
        end

        private

        def update_content?(repository)
          repository.library_instance? && !repository.product.redhat?
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
katello-3.12.3 app/lib/actions/katello/repository/update.rb
katello-3.12.2 app/lib/actions/katello/repository/update.rb
katello-3.12.1 app/lib/actions/katello/repository/update.rb
katello-3.11.2 app/lib/actions/katello/repository/update.rb
katello-3.10.2 app/lib/actions/katello/repository/update.rb
katello-3.12.0 app/lib/actions/katello/repository/update.rb
katello-3.12.0.rc2 app/lib/actions/katello/repository/update.rb
katello-3.10.1.1 app/lib/actions/katello/repository/update.rb
katello-3.12.0.rc1 app/lib/actions/katello/repository/update.rb
katello-3.10.1 app/lib/actions/katello/repository/update.rb
katello-3.11.1 app/lib/actions/katello/repository/update.rb
katello-3.11.0 app/lib/actions/katello/repository/update.rb
katello-3.11.0.rc2 app/lib/actions/katello/repository/update.rb
katello-3.11.0.rc1 app/lib/actions/katello/repository/update.rb
katello-3.10.0 app/lib/actions/katello/repository/update.rb
katello-3.10.0.rc1.1 app/lib/actions/katello/repository/update.rb
katello-3.10.0.rc1 app/lib/actions/katello/repository/update.rb