File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ def next_state
358358 Wait . new ( @machine )
359359 else
360360 to_error ( _ ( "Failed to retrieve certificate for %{certname}: %{message}" ) %
361- { certname : Puppet [ :certname ] , message : e . response . message } , e )
361+ { certname : Puppet [ :certname ] , message : e . message } , e )
362362 end
363363 end
364364 end
@@ -391,7 +391,7 @@ def next_state
391391 end
392392 Done . new ( @machine , @ssl_context )
393393 rescue => e
394- Puppet . warning ( _ ( "Unable to automatically renew certificate: %{message}" ) % { message : e } )
394+ Puppet . warning ( _ ( "Unable to automatically renew certificate: %{message}" ) % { message : e . message } )
395395 Done . new ( @machine , @ssl_context )
396396 end
397397 end
Original file line number Diff line number Diff line change @@ -928,6 +928,14 @@ def write_csr_attributes(data)
928928 expect ( state . next_state ) . to be_an_instance_of ( Puppet ::SSL ::StateMachine ::Wait )
929929 end
930930
931+ it 'transitions to Error if the server returns 500' do
932+ stub_request ( :get , %r{puppet-ca/v1/certificate/#{ Puppet [ :certname ] } } ) . to_return ( status : 500 )
933+
934+ st = state . next_state
935+ expect ( st ) . to be_an_instance_of ( Puppet ::SSL ::StateMachine ::Error )
936+ expect ( st . message ) . to match ( /Failed to retrieve certificate/ )
937+ end
938+
931939 it "verifies the server's certificate when getting the client cert" do
932940 stub_request ( :get , %r{puppet-ca/v1/certificate/#{ Puppet [ :certname ] } } ) . to_return ( status : 200 , body : client_cert . to_pem )
933941 allow ( cert_provider ) . to receive ( :save_client_cert )
You can’t perform that action at this time.
0 commit comments