Module: Puppet::Network::XMLRPCProcessor

Includes:
Authorization
Included in:
Puppet::Network::XMLRPC::WEBrickServlet, XMLRPCServer
Defined in:
lib/vendor/puppet/network/xmlrpc/processor.rb

Overview

Most of our subclassing is just so that we can get access to information from the request object, like the client name and IP address.

Constant Summary collapse

ERR_UNAUTHORIZED =
30

Instance Method Summary collapse

Methods included from Authorization

#authconfig, #authorized?, #available?, #verify

Instance Method Details

#add_handler(interface, handler) ⇒ Object



20
21
22
23
# File 'lib/vendor/puppet/network/xmlrpc/processor.rb', line 20

def add_handler(interface, handler)
  @loadedhandlers << interface.prefix
  super(interface, handler)
end

#handler_loaded?(handler) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/vendor/puppet/network/xmlrpc/processor.rb', line 25

def handler_loaded?(handler)
  @loadedhandlers.include?(handler.to_s)
end

#process(data, request) ⇒ Object

Convert our data and client request into xmlrpc calls, and verify they’re authorized and such-like. This method differs from the default in that it expects a ClientRequest object in addition to the data.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/vendor/puppet/network/xmlrpc/processor.rb', line 33

def process(data, request)
  call, params = parser.parseMethodCall(data)
  params << request.name << request.ip
  handler, method = call.split(".")
  request.handler = handler
  request.method = method
  begin
    verify(request)
  rescue InvalidClientRequest => detail
    raise ::XMLRPC::FaultException.new(ERR_UNAUTHORIZED, detail.to_s)
  end
  handle(request.call, *params)
end