Puppet Function: icinga2::icinga2_ticket_id
- Defined in:
-
lib/puppet/functions/icinga2/icinga2_ticket_id.rb
- Function type:
- Ruby 4.x API
Summary
Summarise what the function does here
Overview
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/puppet/functions/icinga2/icinga2_ticket_id.rb', line 6
Puppet::Functions.create_function(:'icinga2::icinga2_ticket_id') do
dispatch :ticket do
required_param 'String', :cn
required_param 'Variant[String, Sensitive[String]]', :salt
return_type 'String'
end
def ticket(cn, salt)
if salt.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)
salt = salt.unwrap
end
PBKDF2.new(
password: cn,
salt: salt,
iterations: 50_000,
hash_function: OpenSSL::Digest.new('sha1'),
).hex_string
end
end
|