Skip to content

Commit

Permalink
Fixes #35676 - Handle whitespace issue in Python package types
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanshekar committed Feb 4, 2025
1 parent c988a00 commit 8236da3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/controllers/katello/api/v2/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ def create
repo_params[:ssl_client_cert] = ssl_client_cert
repo_params[:ssl_client_key] = ssl_client_key

if repo_params[:package_types]
repo_params[:package_types] = repo_params[:package_types].map(& :strip)
end

root = construct_repo_from_params(repo_params)
sync_task(::Actions::Katello::Repository::CreateRoot, root)
@repository = root.reload.library_instance
Expand Down Expand Up @@ -395,6 +399,10 @@ def update
fail "Do not include the username/password in the URL. Use the username/password settings instead."
end

if repo_params[:package_types]
repo_params[:package_types] = repo_params[:package_types].map(& :strip)
end

if @repository.generic?
generic_remote_options = generic_remote_options_hash(repo_params)
repo_params[:generic_remote_options] = generic_remote_options.to_json
Expand Down
2 changes: 1 addition & 1 deletion lib/katello/repository_types/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
description: N_("Python packages to exclude from the upstream URL, names separated by newline. You may also specify versions, for example: django~=2.0.")

generic_remote_option :package_types, title: N_("Package Types"), type: Array, input_type: "text", delimiter: ",", default: [],
description: N_("Package types to sync for Python content, separated by comma. Leave empty to get every package type. Package types are: bdist_dmg, bdist_dumb, bdist_egg, bdist_msi, bdist_rpm, bdist_wheel, bdist_wininst, sdist.")
description: N_("Package types to sync for Python content, separated by comma. Leave empty to get every package type. Package types are: bdist_dmg,bdist_dumb,bdist_egg,bdist_msi,bdist_rpm,bdist_wheel,bdist_wininst,sdist.")

generic_remote_option :keep_latest_packages, title: N_("Keep latest packages"), type: :number, input_type: "number", default: 0,
description: N_("The amount of latest versions of a package to keep on sync, includes pre-releases if synced. Default 0 keeps all versions.")
Expand Down

0 comments on commit 8236da3

Please sign in to comment.