puppet custom functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Return a random number | |
Puppet::Functions.create_function(:rand) do | |
# @param [Integer] max | |
# maximum random number | |
# @return [Variant[Integer,Float]] | |
# random number | |
# @example Calling the function | |
# rand(10) | |
dispatch :generate_random_number do | |
optional_param 'Integer', :max | |
return_type 'Variant[Integer,Float]' | |
end | |
def generate_random_number(max = nil) | |
rand(max) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment