Puppet Function: simplib::passgen::gen_salt
- Defined in:
- lib/puppet/functions/simplib/passgen/gen_salt.rb
- Function type:
- Ruby 4.x API
Overview
Generates a salt
-
Terminates catalog compilation if the salt cannot be created in the allotted time.
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 |
# File 'lib/puppet/functions/simplib/passgen/gen_salt.rb', line 6 Puppet::Functions.create_function(:'simplib::passgen::gen_salt') do # @param timeout_seconds Maximum time allotted to generate the salt; # a value of 0 disables the timeout # # @return [String] Generated salt # # @raise [Timeout::Error] if password cannot be created within allotted time # dispatch :gen_salt do optional_param 'Variant[Integer[0],Float[0]]', :timeout_seconds end def gen_salt(timeout_seconds = 30) # complexity of 0 is required to prevent disallowed # characters from being included in the salt salt = call_function('simplib::gen_random_password', 16, # length 0, # complexity false, # complex_only timeout_seconds ) salt end end |