app/controllers/katello/api/v2/repositories_controller.rb in katello-4.2.0.1 vs app/controllers/katello/api/v2/repositories_controller.rb in katello-4.2.1
- old
+ new
@@ -54,10 +54,11 @@
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 :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed")
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")
param :upstream_username, String, :desc => N_("Username of the upstream repository user used for authentication")
param :upstream_password, String, :desc => N_("Password of the upstream repository user used for authentication")
+ param :upstream_authentication_token, String, :desc => N_("Password of the upstream authentication token.")
param :ostree_upstream_sync_policy, ::Katello::RootRepository::OSTREE_UPSTREAM_SYNC_POLICIES, :desc => N_("policies for syncing upstream ostree repositories")
param :ostree_upstream_sync_depth, :number, :desc => N_("if a custom sync policy is chosen for ostree repositories then a 'depth' value must be provided")
param :deb_releases, String, :desc => N_("whitespace-separated list of releases to be synced from deb-archive")
param :deb_components, String, :desc => N_("whitespace-separated list of repo components to be synced from deb-archive")
param :deb_architectures, String, :desc => N_("whitespace-separated list of architectures to be synced from deb-archive")
@@ -460,14 +461,15 @@
end
end
# rubocop:disable Metrics/CyclomaticComplexity
def repository_params
- keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password, :upstream_username, :download_concurrency,
+ keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password,
+ :upstream_username, :download_concurrency, :upstream_authentication_token,
:ostree_upstream_sync_depth, :ostree_upstream_sync_policy, {:os_versions => []},
- :deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy, :http_proxy_id, :retain_package_versions_count,
- {:ignorable_content => []}
+ :deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy,
+ :http_proxy_id, :retain_package_versions_count, {:ignorable_content => []}
]
keys += [{:docker_tags_whitelist => []}, :docker_upstream_name] if params[:action] == 'create' || @repository&.docker?
keys += [:ansible_collection_requirements, :ansible_collection_auth_url, :ansible_collection_auth_token] if params[:action] == 'create' || @repository&.ansible_collection?
keys += [:label, :content_type] if params[:action] == "create"
@@ -510,10 +512,11 @@
root.docker_tags_whitelist = repo_params.fetch(:docker_tags_whitelist, []) if root.docker?
root.mirror_on_sync = ::Foreman::Cast.to_bool(repo_params[:mirror_on_sync]) if repo_params.key?(:mirror_on_sync)
root.verify_ssl_on_sync = ::Foreman::Cast.to_bool(repo_params[:verify_ssl_on_sync]) if repo_params.key?(:verify_ssl_on_sync)
root.upstream_username = repo_params[:upstream_username] if repo_params.key?(:upstream_username)
root.upstream_password = repo_params[:upstream_password] if repo_params.key?(:upstream_password)
+ root.upstream_authentication_token = repo_params[:upstream_authentication_token] if repo_params.key?(:upstream_authentication_token)
root.ignorable_content = repo_params[:ignorable_content] if root.yum? && repo_params.key?(:ignorable_content)
root.http_proxy_policy = repo_params[:http_proxy_policy] if repo_params.key?(:http_proxy_policy)
root.http_proxy_id = repo_params[:http_proxy_id] if repo_params.key?(:http_proxy_id)
root.os_versions = repo_params.fetch(:os_versions, []) if root.yum?
root.retain_package_versions_count = repo_params[:retain_package_versions_count] if root.yum? && repo_params.key?(:retain_package_versions_count)
@@ -561,15 +564,24 @@
def find_content
content_type = params[:content_type]
if content_type
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, params[:content_type]) if params[:content_type]
@content = @repository.units_for_removal(params[:ids], content_type)
else
@content = @repository.units_for_removal(params[:ids])
end
- RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.class::CONTENT_TYPE)
+ if @repository.generic?
+ if content_type
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.content_type)
+ else
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, @repository.repository_type.default_managed_content_type.label)
+ end
+ else
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.class::CONTENT_TYPE)
+ end
end
def filter_by_content_view(query, content_view_id, environment_id, is_available_for)
if is_available_for
params[:library] = true