app/controllers/katello/api/v2/repositories_controller.rb in katello-3.18.5 vs app/controllers/katello/api/v2/repositories_controller.rb in katello-4.0.0.rc1

- old
+ new

@@ -23,11 +23,10 @@ before_action :error_on_rh_repo, :only => [:destroy] before_action(:only => [:create, :update]) { find_content_credential CONTENT_CREDENTIAL_GPG_KEY_TYPE } before_action(:only => [:create, :update]) { find_content_credential CONTENT_CREDENTIAL_SSL_CA_CERT_TYPE } before_action(:only => [:create, :update]) { find_content_credential CONTENT_CREDENTIAL_SSL_CLIENT_CERT_TYPE } before_action(:only => [:create, :update]) { find_content_credential CONTENT_CREDENTIAL_SSL_CLIENT_KEY_TYPE } - before_action :check_ignore_global_proxy, :only => [ :update, :create ] skip_before_action :authorize, :only => [:gpg_key_content] skip_before_action :check_media_type, :only => [:upload_content] def custom_index_relation(collection) collection.includes(:product) @@ -43,26 +42,26 @@ param :ssl_client_key_id, :number, :desc => N_("Identifier of the content credential containing the SSL Client Key") param :unprotected, :bool, :desc => N_("true if this repository can be published via HTTP") param :checksum_type, String, :desc => N_("Checksum of the repository, currently 'sha1' & 'sha256' are supported") param :docker_upstream_name, String, :desc => N_("Name of the upstream docker repository") param :docker_tags_whitelist, Array, :desc => N_("Comma-separated list of tags to sync for Container Image repository") - param :download_policy, ["immediate", "on_demand", "background"], :desc => N_("download policy for yum repos (either 'immediate', 'on_demand', or 'background (deprecated)')") + param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for 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 :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 :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_("comma-separated list of releases to be synced from deb-archive") param :deb_components, String, :desc => N_("comma-separated list of repo components to be synced from deb-archive") param :deb_architectures, String, :desc => N_("comma-separated list of architectures to be synced from deb-archive") - param :ignore_global_proxy, :bool, :desc => N_("if true, will ignore the globally configured proxy when syncing"), :deprecated => true param :ignorable_content, Array, :desc => N_("List of content units to ignore while syncing a yum repository. Must be subset of %s") % RootRepository::IGNORABLE_CONTENT_UNIT_TYPES.join(",") param :ansible_collection_requirements, String, :desc => N_("Contents of requirement yaml file to sync from URL") param :http_proxy_policy, ::Katello::RootRepository::HTTP_PROXY_POLICIES, :desc => N_("policies for HTTP proxy for content sync") param :http_proxy_id, :number, :desc => N_("ID of a HTTP Proxy") + param :arch, String, :desc => N_("Architecture of content in the repository") end def_param_group :repo_create do param :label, String, :required => false param :product_id, :number, :required => true, :desc => N_("Product the repository belongs to") @@ -224,14 +223,10 @@ unless RepositoryTypeManager.creatable_by_user?(repo_params[:content_type]) msg = _("Invalid params provided - content_type must be one of %s") % RepositoryTypeManager.creatable_repository_types.keys.join(",") fail HttpErrors::UnprocessableEntity, msg end - if repo_params['content_type'] == "puppet" || repo_params['content_type'] == "ostree" - ::Foreman::Deprecation.api_deprecation_warning("Puppet and OSTree will no longer be supported in Katello 4.0") - end - gpg_key = get_content_credential(repo_params, CONTENT_CREDENTIAL_GPG_KEY_TYPE) ssl_ca_cert = get_content_credential(repo_params, CONTENT_CREDENTIAL_SSL_CA_CERT_TYPE) ssl_client_cert = get_content_credential(repo_params, CONTENT_CREDENTIAL_SSL_CLIENT_CERT_TYPE) ssl_client_key = get_content_credential(repo_params, CONTENT_CREDENTIAL_SSL_CLIENT_KEY_TYPE) @@ -493,21 +488,10 @@ :checksum_type] end params.require(:repository).permit(*keys).to_h.with_indifferent_access end - def check_ignore_global_proxy - if params.key?(:ignore_global_proxy) - ::Foreman::Deprecation.api_deprecation_warning("The parameter ignore_global_proxy will be removed in a future Katello release. Please update to use the http_proxy_policy parameter.") - if ::Foreman::Cast.to_bool(params[:ignore_global_proxy]) - params[:repository][:http_proxy_policy] = RootRepository::NO_DEFAULT_HTTP_PROXY - else - params[:repository][:http_proxy_policy] = RootRepository::GLOBAL_DEFAULT_HTTP_PROXY - end - end - end - def get_content_credential(repo_params, content_type) credential_value = @product.send(content_type) unless repo_params["#{content_type}_id".to_sym].blank? credential_value = instance_variable_get("@#{content_type}") @@ -515,10 +499,10 @@ credential_value end # rubocop:disable Metrics/CyclomaticComplexity - def construct_repo_from_params(repo_params) + def construct_repo_from_params(repo_params) # rubocop:disable Metrics/AbcSize 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, :http_proxy_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.fetch(:docker_tags_whitelist, []) if root.docker?