Class: Puppet::HTTP::Service::Puppetserver
- Inherits:
-
Puppet::HTTP::Service
- Object
- Puppet::HTTP::Service
- Puppet::HTTP::Service::Puppetserver
- Defined in:
- lib/puppet/http/service/puppetserver.rb
Overview
The puppetserver service.
Constant Summary
Constants inherited from Puppet::HTTP::Service
EXCLUDED_FORMATS, SERVICE_NAMES
Instance Attribute Summary
Attributes inherited from Puppet::HTTP::Service
Instance Method Summary collapse
-
#get_simple_status(ssl_context: nil) ⇒ Object
Request the puppetserver’s simple status.
-
#initialize(client, session, server, port) ⇒ Puppetserver
constructor
Use ‘Puppet::HTTP::Session.route_to(:puppetserver)` to create or get an instance of this class.
Methods inherited from Puppet::HTTP::Service
#connect, create_service, valid_name?, #with_base_url
Constructor Details
#initialize(client, session, server, port) ⇒ Puppetserver
Use ‘Puppet::HTTP::Session.route_to(:puppetserver)` to create or get an instance of this class.
19 20 21 22 |
# File 'lib/puppet/http/service/puppetserver.rb', line 19 def initialize(client, session, server, port) url = build_url('', server || Puppet[:server], port || Puppet[:serverport]) super(client, session, url) end |
Instance Method Details
#get_simple_status(ssl_context: nil) ⇒ Object
Request the puppetserver’s simple status.
the connection.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/puppet/http/service/puppetserver.rb', line 32 def get_simple_status(ssl_context: nil) request_path = "/status/v1/simple/server" begin response = @client.get( with_base_url(request_path), headers: add_puppet_headers({}), options: { ssl_context: ssl_context } ) process_response(response) rescue Puppet::HTTP::ResponseError => e if e.response.code == 404 && e.response.url.path == "/status/v1/simple/server" request_path = "/status/v1/simple/master" retry else raise e end end [response, response.body.to_s] end |