Created
January 2, 2023 19:13
-
-
Save h0tw1r3/e80e5cf039f6598c3b14f15274277123 to your computer and use it in GitHub Desktop.
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