Commit 953f77dd authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Rafael Monnerat

slapos.recipes.random: Add Integer recipe.

parent 40f3b64c
......@@ -163,6 +163,7 @@ setup(name=name,
'publishsection = slapos.recipe.publish:PublishSection',
'publishurl = slapos.recipe.publishurl:Recipe',
'random.time = slapos.recipe.random:Time',
'random.integer = slapos.recipe.random:Integer',
'readline = slapos.recipe.readline:Recipe',
'redis.server = slapos.recipe.redis:Recipe',
'request = slapos.recipe.request:Recipe',
......
......@@ -39,6 +39,28 @@ import string
from slapos.recipe.librecipe import GenericBaseRecipe
class Integer(object):
"""
Generate a random integer (see standard random.randint documentation).
Input options:
minimum (required)
integer(-ish) minmum bound, included.
maximum (required)
integer(-ish) maximum bound, included.
Output options:
value
Resulting integer.
"""
def __init__(self, buildout, name, options):
options['value'] = random.randint(int(options['minimum']), int(options['maximum']))
def install(self):
pass
update = install
class Time(object):
"""Generate a random time from a 24h time clock"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment