summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/pw_hash.rb
diff options
context:
space:
mode:
authorTP Honey <tphoney@users.noreply.github.com>2015-05-05 14:35:48 +0100
committerTP Honey <tphoney@users.noreply.github.com>2015-05-05 14:35:48 +0100
commit7181e4ebcaf59cb16e7166aa254cbb637590423a (patch)
tree3b45b6b6e4ef0a249096ed827d2599e80100ec57 /lib/puppet/parser/functions/pw_hash.rb
parentc7a23b226d5293e24cc52229c6162425ad473b6f (diff)
parentd4f3d57f1678ae03a58a17181f863c44c248f09b (diff)
downloadpuppet-stdlib-7181e4ebcaf59cb16e7166aa254cbb637590423a.tar.gz
puppet-stdlib-7181e4ebcaf59cb16e7166aa254cbb637590423a.tar.bz2
Merge pull request #443 from DavidS/prep-work-for-new-specs
Prep work for new specs
Diffstat (limited to 'lib/puppet/parser/functions/pw_hash.rb')
-rw-r--r--lib/puppet/parser/functions/pw_hash.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/puppet/parser/functions/pw_hash.rb b/lib/puppet/parser/functions/pw_hash.rb
index ad3e393..4682a63 100644
--- a/lib/puppet/parser/functions/pw_hash.rb
+++ b/lib/puppet/parser/functions/pw_hash.rb
@@ -42,15 +42,13 @@ Puppet::Parser::Functions::newfunction(
if 'test'.crypt('$1$1') != '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
# JRuby < 1.7.17
if RUBY_PLATFORM == 'java'
- # override String#crypt for password variable
- def password.crypt(salt)
- # puppetserver bundles Apache Commons Codec
- org.apache.commons.codec.digest.Crypt.crypt(self.to_java_bytes, salt)
- end
+ # puppetserver bundles Apache Commons Codec
+ org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
else
# MS Windows and other systems that don't support enhanced salts
raise Puppet::ParseError, 'system does not support enhanced salts'
end
+ else
+ password.crypt("$#{hash_type}$#{args[2]}")
end
- password.crypt("$#{hash_type}$#{args[2]}")
end