app/controllers/katello/api/v2/repositories_controller.rb in katello-3.11.2 vs app/controllers/katello/api/v2/repositories_controller.rb in katello-3.12.0.rc1

- old
+ new

@@ -79,10 +79,11 @@ param :file_id, String, :desc => N_("Id of a file to find repositories that contain the file") param :ostree_branch_id, String, :desc => N_("Id of an ostree branch to find repositories that contain that branch") param :library, :bool, :desc => N_("show repositories in Library and the default content view") param :content_type, RepositoryTypeManager.repository_types.keys, :desc => N_("limit to only repositories of this type") param :name, String, :desc => N_("name of the repository"), :required => false + param :label, String, :desc => N_("label of the repository"), :required => false param :description, String, :desc => N_("description of the repository") param :available_for, String, :desc => N_("interpret specified object to return only Repositories that can be associated with specified object. Only 'content_view' & 'content_view_version' are supported."), :required => false param_group :search, Api::V2::ApiController def index @@ -113,10 +114,11 @@ def index_relation query = Repository.readable query = index_relation_product(query) query = query.with_type(params[:content_type]) if params[:content_type] query = query.where(:root_id => RootRepository.where(:name => params[:name])) if params[:name] + query = query.where(:root_id => RootRepository.where(:label => params[:label])) if params[:label] query = index_relation_content_unit(query) query = index_relation_content_view(query) query = index_relation_environment(query) query end @@ -441,18 +443,18 @@ end def repository_params keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password, :upstream_username, :ostree_upstream_sync_depth, :ostree_upstream_sync_policy, :ignore_global_proxy, - :deb_releases, :deb_components, :deb_architectures, :description, {:ignorable_content => []}, - {:docker_tags_whitelist => []} + :deb_releases, :deb_components, :deb_architectures, :description, {:ignorable_content => []} ] + keys += [{:docker_tags_whitelist => []}, :docker_upstream_name] if params[:action] == 'create' || @repository&.docker? keys += [:label, :content_type] if params[:action] == "create" if params[:action] == 'create' || @repository.custom? keys += [:url, :gpg_key_id, :ssl_ca_cert_id, :ssl_client_cert_id, :ssl_client_key_id, :unprotected, :name, - :checksum_type, :docker_upstream_name] + :checksum_type] end params.require(:repository).permit(*keys).to_h.with_indifferent_access end def get_content_credential(repo_params, content_type) @@ -469,10 +471,10 @@ def construct_repo_from_params(repo_params) root = @product.add_repo(repo_params.slice(:label, :name, :description, :url, :content_type, :arch, :unprotected, :gpg_key, :ssl_ca_cert, :ssl_client_cert, :ssl_client_key, :checksum_type, :download_policy).to_h.with_indifferent_access) root.docker_upstream_name = repo_params[:docker_upstream_name] if repo_params[:docker_upstream_name] - root.docker_tags_whitelist = repo_params[:docker_tags_whitelist] if repo_params[:docker_tags_whitelist] + 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.ignore_global_proxy = ::Foreman::Cast.to_bool(repo_params[:ignore_global_proxy]) if repo_params.key?(:ignore_global_proxy) 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)