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.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)
      root.ignorable_content = repo_params[:ignorable_content] if root.yum? && repo_params.key?(:ignorable_content)

      if root.ostree?
        root.ostree_upstream_sync_policy = repo_params[:ostree_upstream_sync_policy]
        root.ostree_upstream_sync_depth = repo_params[:ostree_upstream_sync_depth]
      end
      if root.deb?
        root.deb_releases = repo_params[:deb_releases] if repo_params[:deb_releases]
        root.deb_components = repo_params[:deb_components] if repo_params[:deb_components]
        root.deb_architectures = repo_params[:deb_architectures] if repo_params[:deb_architectures]
      end

      root
    end
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.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)
      root.ignorable_content = repo_params[:ignorable_content] if root.yum? && repo_params.key?(:ignorable_content)

      if root.ostree?
        root.ostree_upstream_sync_policy = repo_params[:ostree_upstream_sync_policy]
        root.ostree_upstream_sync_depth = repo_params[:ostree_upstream_sync_depth]
      end
      if root.deb?
        root.deb_releases = repo_params[:deb_releases] if repo_params[:deb_releases]
        root.deb_components = repo_params[:deb_components] if repo_params[:deb_components]
        root.deb_architectures = repo_params[:deb_architectures] if repo_params[:deb_architectures]
      end

      root
    end
rubocop:disable Metrics/CyclomaticComplexity