Sha256: 8b4e05845d85a14abd7eaf2bbb921b75bd62e8e0d52881de86eac49c47e16cac

Contents?: true

Size: 982 Bytes

Versions: 4

Compression:

Stored size: 982 Bytes

Contents

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

        input_format do
          param :id, Integer
          param :capsule_id, Integer
        end

        def run
          repository = ::Katello::Repository.find(input[:id])
          return unless needs_download?(repository)

          capsule = if input[:capsule_id].present?
                      SmartProxy.unscoped.find(input[:capsule_id])
                    else
                      SmartProxy.default_capsule!
                    end

          downloader = ::Katello::PxeFilesDownloader.new(repository, capsule)
          downloader.download_files
        end

        private

        def needs_download?(repository)
          repository.distribution_bootable? &&
             repository.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katello-3.9.1 app/lib/actions/katello/repository/fetch_pxe_files.rb
katello-3.9.0 app/lib/actions/katello/repository/fetch_pxe_files.rb
katello-3.9.0.rc2 app/lib/actions/katello/repository/fetch_pxe_files.rb
katello-3.9.0.rc1 app/lib/actions/katello/repository/fetch_pxe_files.rb