File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -242,20 +242,7 @@ def self.base_context(settings)
242242 {
243243 :environments => Puppet ::Environments ::Cached . new ( Puppet ::Environments ::Combined . new ( *loaders ) ) ,
244244 :http_pool => proc { Puppet . runtime [ :http ] . pool } ,
245- :ssl_context => proc {
246- begin
247- cert = Puppet ::X509 ::CertProvider . new
248- password = cert . load_private_key_password
249- ssl = Puppet ::SSL ::SSLProvider . new
250- ssl . load_context ( certname : Puppet [ :certname ] , password : password )
251- rescue => e
252- # TRANSLATORS: `message` is an already translated string of why SSL failed to initialize
253- Puppet . log_exception ( e , _ ( "Failed to initialize SSL: %{message}" ) % { message : e . message } )
254- # TRANSLATORS: `puppet agent -t` is a command and should not be translated
255- Puppet . err ( _ ( "Run `puppet agent -t`" ) )
256- raise e
257- end
258- } ,
245+ :ssl_context => proc { Puppet . runtime [ :http ] . default_ssl_context } ,
259246 :ssl_host => proc { Puppet ::SSL ::Host . localhost ( true ) } ,
260247 :http_session => proc { Puppet . runtime [ :http ] . create_session } ,
261248 :plugins => proc { Puppet ::Plugins ::Configuration . load_plugins } ,
Original file line number Diff line number Diff line change @@ -274,6 +274,20 @@ def close
274274 @pool . close
275275 end
276276
277+ def default_ssl_context
278+ cert = Puppet ::X509 ::CertProvider . new
279+ password = cert . load_private_key_password
280+
281+ ssl = Puppet ::SSL ::SSLProvider . new
282+ ssl . load_context ( certname : Puppet [ :certname ] , password : password )
283+ rescue => e
284+ # TRANSLATORS: `message` is an already translated string of why SSL failed to initialize
285+ Puppet . log_exception ( e , _ ( "Failed to initialize SSL: %{message}" ) % { message : e . message } )
286+ # TRANSLATORS: `puppet agent -t` is a command and should not be translated
287+ Puppet . err ( _ ( "Run `puppet agent -t`" ) )
288+ raise e
289+ end
290+
277291 protected
278292
279293 def encode_query ( url , params )
You can’t perform that action at this time.
0 commit comments