Commit abd1d19a authored by Nicolas Wavrant's avatar Nicolas Wavrant

dcron: new recipe to get a random time in a day

parent 4cffe785
......@@ -94,6 +94,7 @@ setup(name=name,
'copyfilelist = slapos.recipe.copyfilelist:Recipe',
'cron = slapos.recipe.dcron:Recipe',
'cron.d = slapos.recipe.dcron:Part',
'cron.random.time = slapos.recipe.dcron:RandomTime',
'davstorage = slapos.recipe.davstorage:Recipe',
'dropbear = slapos.recipe.dropbear:Recipe',
'dropbear.add_authorized_key = slapos.recipe.dropbear:AddAuthorizedKey',
......
......@@ -139,3 +139,15 @@ def systemd_to_cron(spec):
raise ValueError
return ' '.join(spec)
class RandomTime():
def __init__(self, buildout, name, options):
self.name = name
self.buildout = buildout
self.options = options
self.options['time'] = "%d:%d" % (randint(0, 23), randint(0, 59))
def install(self):
pass
update = install
\ No newline at end of file
  • I prefer a slapos/recipe/random.py file collecting all kind of random data we may have to generate. The code of generatepassword.py could even be moved to it. If necessary, other file may have to begin with from __future__ import absolute_import.

    So as recipe name, I prefer random.calendar.

    Also remove dead code, and add a newline at end of file.

  • I'm also in favor on a random too, seems more generic (which is is better).

  • Yes, a central recipe collecting all things about random sounds good to me too.

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