summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric Putnam <putnam.eric@gmail.com>2017-07-07 17:30:17 -0700
committerEric Putnam <putnam.eric@gmail.com>2017-07-18 14:03:04 -0700
commit42d4ea7af9197f77a3062727eb166c719ca6296a (patch)
treed073cad34921cef19241fa688a54e6cc1e59fd90 /lib
parent596878a7bc1fd4a64da89c5c760accb3e8178ec1 (diff)
(MODULES-4908) adds support for sensitive data type to pw_hash
Also includes a small fix to integer_spec so tests pass.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/functions/pw_hash.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/pw_hash.rb b/lib/puppet/parser/functions/pw_hash.rb
index d99ee5b..0deeb3a 100644
--- a/lib/puppet/parser/functions/pw_hash.rb
+++ b/lib/puppet/parser/functions/pw_hash.rb
@@ -27,6 +27,13 @@ Puppet::Parser::Functions::newfunction(
environment contains several different operating systems, ensure that they
are compatible before using this function.") do |args|
raise ArgumentError, "pw_hash(): wrong number of arguments (#{args.size} for 3)" if args.size != 3
+ args.map! do |arg|
+ if arg.is_a? Puppet::Pops::Types::PSensitiveType::Sensitive
+ arg.unwrap
+ else
+ arg
+ end
+ end
raise ArgumentError, "pw_hash(): first argument must be a string" unless args[0].is_a? String or args[0].nil?
raise ArgumentError, "pw_hash(): second argument must be a string" unless args[1].is_a? String
hashes = { 'md5' => '1',