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
212 def next_state
213   Puppet.debug(_("Generating and submitting a CSR"))
214 
215   csr = @cert_provider.create_request(Puppet[:certname], @private_key)
216   route = @machine.session.route_to(:ca, ssl_context: @ssl_context)
217   route.put_certificate_request(Puppet[:certname], csr, ssl_context: @ssl_context)
218   @cert_provider.save_request(Puppet[:certname], csr)
219   NeedCert.new(@machine, @ssl_context, @private_key)
220 rescue Puppet::HTTP::ResponseError => e
221   if e.response.code == 400
222     NeedCert.new(@machine, @ssl_context, @private_key)
223   else
224     to_error(_("Failed to submit the CSR, HTTP response was %{code}") % { code: e.response.code }, e)
225   end
226 end