Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/puppet/parser/functions/sha1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

require 'digest/sha1'

Puppet::Parser::Functions.newfunction(:sha1, :type => :rvalue, :arity => 1, :doc => "Returns a SHA1 hash value from a provided string.") do |args|
Puppet::Parser::Functions.newfunction(:sha1, :type => :rvalue, :arity => 1, :doc => "Returns a SHA1 hash value from a provided string.

*Deprecated:* this function will be removed in a future release. Use the
`sha256()` function from the `puppetlabs-stdlib` module instead.") do |args|
Puppet.puppet_deprecation_warning(
_("The sha1() function is deprecated and will be removed in a future release. " \
"Use the sha256() function from the puppetlabs-stdlib module instead."),
key: 'puppet-sha1-function-deprecated'
)
Digest::SHA1.hexdigest(args[0])
end