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)
242
242
{
243
243
:environments => Puppet ::Environments ::Cached . new ( Puppet ::Environments ::Combined . new ( *loaders ) ) ,
244
244
: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 } ,
259
246
:ssl_host => proc { Puppet ::SSL ::Host . localhost ( true ) } ,
260
247
:http_session => proc { Puppet . runtime [ :http ] . create_session } ,
261
248
:plugins => proc { Puppet ::Plugins ::Configuration . load_plugins } ,
Original file line number Diff line number Diff line change @@ -274,6 +274,20 @@ def close
274
274
@pool . close
275
275
end
276
276
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
+
277
291
protected
278
292
279
293
def encode_query ( url , params )
You can’t perform that action at this time.
0 commit comments