Method: Puppet::HTTP::Service.create_service

Defined in:
lib/puppet/http/service.rb

.create_service(client, session, name, server = nil, port = nil) ⇒ Puppet::HTTP::Service

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a new web service, which contains the URL used to connect to the service. The four services implemented are :ca, :fileserver, :puppet, and :report.

The :ca and :report services handle certs and reports, respectively. The :fileserver service handles puppet file metadata and content requests. And the default service, :puppet, handles nodes, facts, and catalogs.

Parameters:

  • client (Puppet::HTTP::Client)

    the owner of the session

  • session (Puppet::HTTP::Session)

    the owner of the service

  • name (Symbol)

    the type of service to create

  • server (<Type>) (defaults to: nil)

    optional, the server to connect to

  • port (<Type>) (defaults to: nil)

    optional, the port to connect to

Returns:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/puppet/http/service.rb', line 34

def self.create_service(client, session, name, server = nil, port = nil)
  case name
  when :ca
    Puppet::HTTP::Service::Ca.new(client, session, server, port)
  when :fileserver
    Puppet::HTTP::Service::FileServer.new(client, session, server, port)
  when :puppet
    ::Puppet::HTTP::Service::Compiler.new(client, session, server, port)
  when :puppetserver
    ::Puppet::HTTP::Service::Puppetserver.new(client, session, server, port)
  when :report
    Puppet::HTTP::Service::Report.new(client, session, server, port)
  else
    raise ArgumentError, "Unknown service #{name}"
  end
end