diff --git a/app/controllers/katello/api/v2/repositories_controller.rb b/app/controllers/katello/api/v2/repositories_controller.rb index ad1cc6da3e8..f7e2f2e6c08 100644 --- a/app/controllers/katello/api/v2/repositories_controller.rb +++ b/app/controllers/katello/api/v2/repositories_controller.rb @@ -52,7 +52,7 @@ def custom_index_relation(collection) param :docker_upstream_name, String, :desc => N_("Name of the upstream docker repository") param :include_tags, Array, :desc => N_("Comma-separated list of tags to sync for a container image repository") param :exclude_tags, Array, :desc => N_("Comma-separated list of tags to exclude when syncing a container image repository. Default: any tag ending in \"-source\"") - param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for yum, deb, and docker repos (either 'immediate' or 'on_demand')") + param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for deb, docker, file and yum repos (either 'immediate' or 'on_demand')") param :download_concurrency, :number, :desc => N_("Used to determine download concurrency of the repository in pulp3. Use value less than 20. Defaults to 10") param :mirroring_policy, Katello::RootRepository::MIRRORING_POLICIES, :desc => N_("Policy to set for mirroring content. Must be one of %s.") % RootRepository::MIRRORING_POLICIES param :verify_ssl_on_sync, :bool, :desc => N_("if true, Katello will verify the upstream url's SSL certifcates are signed by a trusted CA") diff --git a/app/models/katello/root_repository.rb b/app/models/katello/root_repository.rb index bebc763a9af..aaab69f8a5b 100644 --- a/app/models/katello/root_repository.rb +++ b/app/models/katello/root_repository.rb @@ -23,7 +23,7 @@ class RootRepository < Katello::Model SKIPABLE_METADATA_TYPES = [Repository::YUM_TYPE, Repository::DEB_TYPE].freeze CONTENT_ATTRIBUTE_RESTRICTIONS = { - :download_policy => [Repository::YUM_TYPE, Repository::DEB_TYPE, Repository::DOCKER_TYPE], + :download_policy => [Repository::YUM_TYPE, Repository::DEB_TYPE, Repository::DOCKER_TYPE, Repository::FILE_TYPE], }.freeze MAX_EXPIRE_TIME = 7 * 24 * 60 * 60 @@ -218,12 +218,6 @@ def self.hosts_with_applicability ::Host.joins(:content_facet => :bound_repositories).where("#{Katello::Repository.table_name}.root_id" => self.select(:id)) end - def ensure_no_download_policy - if !yum? && download_policy.present? - errors.add(:download_policy, _("cannot be set for non-yum repositories.")) - end - end - def ensure_no_checksum_on_demand if checksum_type.present? && download_policy == DOWNLOAD_ON_DEMAND errors.add(:checksum_type, _("Checksum type cannot be set for yum repositories with on demand download policy.")) diff --git a/app/services/katello/pulp3/repository/file.rb b/app/services/katello/pulp3/repository/file.rb index 1b7b2bbbc28..8e158f5aa6e 100644 --- a/app/services/katello/pulp3/repository/file.rb +++ b/app/services/katello/pulp3/repository/file.rb @@ -17,12 +17,14 @@ def distribution_options(path) end def remote_options + options = common_remote_options #TODO: move to user specifying PULP_MANIFEST if root.url.blank? - common_remote_options.merge(url: nil) + options[:url] = nil else - common_remote_options.merge(url: root.url + '/PULP_MANIFEST') + options[:url] = root.url + '/PULP_MANIFEST' end + options.merge!(policy: root.download_policy) end def partial_repo_path diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html b/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html index 939bbe71561..ef3c4d5f12c 100644 --- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html @@ -54,7 +54,7 @@

Publishing Settings

Metadata Expiration (Seconds)
-
Sync Settings
- +
{{option.title}}
Sync Settings options="certs()" on-save="save(repository)">
- +
Download Policy
Sync Settings
Warning. Are you sure you want to add a comma in this whitespace separated list of distributions?
- +
@@ -296,7 +296,7 @@

Sync Settings

-
+