Sha256: 48da6de76f435687cb74bc00e0ece2da920a458c0d753351875c2e5c2ecf5790

Contents?: true

Size: 1.77 KB

Versions: 28

Compression:

Stored size: 1.77 KB

Contents

module Actions
  module Katello
    module Repository
      class Update < Actions::EntryAction
        middleware.use Actions::Middleware::KeepCurrentUser

        def plan(repository, repo_params)
          action_subject repository
          repository = repository.reload
          repo_params[:url] = nil if repo_params[:url] == ''
          repository.update_attributes!(repo_params)

          if update_content?(repository)
            plan_action(::Actions::Candlepin::Product::ContentUpdate,
                        :content_id => repository.content_id,
                        :name => repository.content.name,
                        :content_url => ::Katello::Glue::Pulp::Repos.custom_content_path(repository.product, repository.label),
                        :gpg_key_url => repository.yum_gpg_key_url,
                        :label => repository.content.label,
                        :type => repository.content_type)
          end

          if SETTINGS[:katello][:use_pulp] && repository.pulp_update_needed?
            plan_action(::Actions::Pulp::Repository::Refresh, repository)
          end

          if SETTINGS[:katello][:use_pulp] && (repository.previous_changes.key?('unprotected') ||
              repository.previous_changes.key?('checksum_type'))
            plan_self(:repository_id => repository.id)
          end
        end

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

        private

        def update_content?(repository)
          SETTINGS[:katello][:use_cp] &&
            SETTINGS[:katello][:use_pulp] &&
            repository.library_instance? &&
            !repository.product.redhat?
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
katello-3.3.2 app/lib/actions/katello/repository/update.rb
katello-3.3.1.1 app/lib/actions/katello/repository/update.rb
katello-3.3.1 app/lib/actions/katello/repository/update.rb
katello-3.3.0.1 app/lib/actions/katello/repository/update.rb
katello-3.3.0 app/lib/actions/katello/repository/update.rb
katello-3.3.0.rc2 app/lib/actions/katello/repository/update.rb
katello-3.3.0.rc1.1 app/lib/actions/katello/repository/update.rb
katello-3.3.0.rc1 app/lib/actions/katello/repository/update.rb
katello-3.2.1.1 app/lib/actions/katello/repository/update.rb
katello-3.2.1 app/lib/actions/katello/repository/update.rb
katello-3.2.0 app/lib/actions/katello/repository/update.rb
katello-3.2.0.rc3 app/lib/actions/katello/repository/update.rb
katello-3.2.0.rc2 app/lib/actions/katello/repository/update.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/repository/update.rb
katello-3.2.0.rc1 app/lib/actions/katello/repository/update.rb
katello-3.1.0.1 app/lib/actions/katello/repository/update.rb
katello-3.1.0 app/lib/actions/katello/repository/update.rb
katello-3.1.0.rc2.1 app/lib/actions/katello/repository/update.rb
katello-3.0.2 app/lib/actions/katello/repository/update.rb
katello-3.1.0.rc1 app/lib/actions/katello/repository/update.rb