@@ -280,7 +280,7 @@ def update
280280 end
281281
282282 def certificate
283- return @resource [ :certificate ] if @resource [ :certificate ]
283+ return @resource [ :certificate ] if @resource [ :certificate ]
284284
285285 # When no certificate file is specified, we infer the usage of
286286 # certificate content and create a tempfile containing this value.
@@ -296,20 +296,17 @@ def certificate
296296
297297 def private_key
298298 return @resource [ :private_key ] if @resource [ :private_key ]
299- if @resource [ :private_key_content ]
300-
301-
302- # When no private key file is specified, we infer the usage of
303- # private key content and create a tempfile containing this value.
304- # we leave it to to the tempfile to clean it up after the pupet run exists.
305- file = Tempfile . new ( 'private_key' )
306- # Check if the specified value is a Sensitive data type. If so, unwrap it and use
307- # the value.
308- content = @resource [ :private_key_content ] . respond_to? ( :unwrap ) ? @resource [ :private_key_content ] . unwrap : @resource [ :private_key_content ]
309- file . write ( content )
310- file . close
311- file . path
312- end
299+ return unless @resource [ :private_key_content ]
300+ # When no private key file is specified, we infer the usage of
301+ # private key content and create a tempfile containing this value.
302+ # we leave it to to the tempfile to clean it up after the pupet run exists.
303+ file = Tempfile . new ( 'private_key' )
304+ # Check if the specified value is a Sensitive data type. If so, unwrap it and use
305+ # the value.
306+ content = @resource [ :private_key_content ] . respond_to? ( :unwrap ) ? @resource [ :private_key_content ] . unwrap : @resource [ :private_key_content ]
307+ file . write ( content )
308+ file . close
309+ file . path
313310 end
314311
315312 def private_key_type
0 commit comments