Sha256: 3ac38569513f62fecbd6ba751acb6ce2fb09c1ac51247d0e40db140ec4c80c67

Contents?: true

Size: 1.85 KB

Versions: 239

Compression:

Stored size: 1.85 KB

Contents

class Puppet::Network::HTTP::API
  require 'puppet/version'

  def self.not_found
    Puppet::Network::HTTP::Route.
      path(/.*/).
      any(lambda do |req, res|
        raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new("No route for #{req.method} #{req.path}", Puppet::Network::HTTP::Issues::HANDLER_NOT_FOUND)
      end)
  end

  def self.not_found_upgrade
    Puppet::Network::HTTP::Route.
      path(/.*/).
      any(lambda do |req, res|
        raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new("Error: Invalid URL - Puppet expects requests that conform to the " +
                                                                      "/puppet and /puppet-ca APIs.\n\n" +
                                                                      "Note that Puppet 3 agents aren't compatible with this version; if you're " +
                                                                      "running Puppet 3, you must either upgrade your agents to match the server " +
                                                                      "or point them to a server running Puppet 3.\n\n" +
                                                                      "Master Info:\n" +
                                                                      "  Puppet version: #{Puppet.version}\n" +
                                                                      "  Supported /puppet API versions: #{Puppet::Network::HTTP::MASTER_URL_VERSIONS}\n",
                                                                  Puppet::Network::HTTP::Issues::HANDLER_NOT_FOUND)
      end)
  end

  def self.master_routes
    master_prefix = Regexp.new("^#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/")
    Puppet::Network::HTTP::Route.path(master_prefix).
      any.
      chain(Puppet::Network::HTTP::API::Master::V3.routes,
            Puppet::Network::HTTP::API.not_found)
  end
end

Version data entries

239 entries across 239 versions & 2 rubygems

Version Path
puppet-6.21.1 lib/puppet/network/http/api.rb
puppet-6.21.1-x86-mingw32 lib/puppet/network/http/api.rb
puppet-6.21.1-x64-mingw32 lib/puppet/network/http/api.rb
puppet-6.21.1-universal-darwin lib/puppet/network/http/api.rb
puppet-7.4.0 lib/puppet/network/http/api.rb
puppet-7.4.0-x86-mingw32 lib/puppet/network/http/api.rb
puppet-7.4.0-x64-mingw32 lib/puppet/network/http/api.rb
puppet-7.4.0-universal-darwin lib/puppet/network/http/api.rb
puppet-6.21.0 lib/puppet/network/http/api.rb
puppet-6.21.0-x86-mingw32 lib/puppet/network/http/api.rb
puppet-6.21.0-x64-mingw32 lib/puppet/network/http/api.rb
puppet-6.21.0-universal-darwin lib/puppet/network/http/api.rb
puppet-7.3.0 lib/puppet/network/http/api.rb
puppet-7.3.0-x86-mingw32 lib/puppet/network/http/api.rb
puppet-7.3.0-x64-mingw32 lib/puppet/network/http/api.rb
puppet-7.3.0-universal-darwin lib/puppet/network/http/api.rb
puppet-6.20.0 lib/puppet/network/http/api.rb
puppet-6.20.0-x86-mingw32 lib/puppet/network/http/api.rb
puppet-6.20.0-x64-mingw32 lib/puppet/network/http/api.rb
puppet-6.20.0-universal-darwin lib/puppet/network/http/api.rb