@@ -777,7 +777,7 @@ def prepare_credentials(resource)
777777 variable_name = random_variable_name
778778 credential_hash = {
779779 'user' => property_hash [ :value ] [ 'user' ] ,
780- 'password' => escape_quotes ( unwrap ( property_hash [ :value ] [ 'password' ] ) )
780+ 'password' => escape_quotes ( unwrap_string ( property_hash [ :value ] [ 'password' ] ) )
781781 }
782782 credentials_block << format_pscredential ( variable_name , credential_hash )
783783 instantiated_variables . merge! ( variable_name => credential_hash )
@@ -908,7 +908,7 @@ def invoke_params(resource)
908908 # the Credential hash interpolable as it will be replaced by a variable reference.
909909 {
910910 'user' => property_hash [ :value ] [ 'user' ] ,
911- 'password' => escape_quotes ( unwrap ( property_hash [ :value ] [ 'password' ] ) )
911+ 'password' => escape_quotes ( unwrap_string ( property_hash [ :value ] [ 'password' ] ) )
912912 }
913913 when 'DateTime'
914914 # These have to be handled specifically because they rely on the *Puppet* DateTime,
@@ -1001,6 +1001,19 @@ def unwrap(value)
10011001 end
10021002 end
10031003
1004+ # Unwrap sensitive strings and handle string
1005+ #
1006+ # @param value [Object] The object to unwrap sensitive data inside of
1007+ # @return [Object] The object with any sensitive strings unwrapped
1008+ def unwrap_string ( value )
1009+ case value
1010+ when Puppet ::Pops ::Types ::PSensitiveType ::Sensitive
1011+ value . unwrap
1012+ else
1013+ value
1014+ end
1015+ end
1016+
10041017 # Escape any nested single quotes in a Sensitive string
10051018 #
10061019 # @param text [String] the text to escape
0 commit comments