Puppet Function: ora_secured::random_id
- Defined in:
- lib/puppet/functions/ora_secured/random_id.rb
- Function type:
- Ruby 4.x API
Summary
Create a random id based on letters.Overview
See the file “LICENSE” for the full license governing this code.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/puppet/functions/ora_secured/random_id.rb', line 6 Puppet::Functions.create_function('ora_secured::random_id') do dispatch :random_id do param 'Integer', :length # return_type 'Boolean' TODO: Wait until the Puppet version supporting this, is mainstream end def random_id(length = 6) random_letter(length) end def random_letter(length = 1) (('A'..'Z').to_a + ('a'..'z').to_a).sort_by { rand }.join[0...length] end end |