class Puppet::SSL::StateMachine::NeedSubmitCSR

Generate and submit a CSR using the CA cert bundle and optional CRL bundle from earlier states. If the request is submitted, proceed to NeedCert, otherwise Wait. This could be due to the server already having a CSR for this host (either the same or different CSR content), having a signed certificate, or a revoked certificate.

Public Instance Methods

next_state() click to toggle source
    # File lib/puppet/ssl/state_machine.rb
222 def next_state
223   Puppet.debug(_("Generating and submitting a CSR"))
224 
225   csr = @cert_provider.create_request(Puppet[:certname], @private_key)
226   route = @machine.session.route_to(:ca, ssl_context: @ssl_context)
227   route.put_certificate_request(Puppet[:certname], csr, ssl_context: @ssl_context)
228   @cert_provider.save_request(Puppet[:certname], csr)
229   NeedCert.new(@machine, @ssl_context, @private_key)
230 rescue Puppet::HTTP::ResponseError => e
231   if e.response.code == 400
232     NeedCert.new(@machine, @ssl_context, @private_key)
233   else
234     to_error(_("Failed to submit the CSR, HTTP response was %{code}") % { code: e.response.code }, e)
235   end
236 end