Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos
Commits
953f77dd
Commit
953f77dd
authored
Apr 20, 2017
by
Vincent Pelletier
Committed by
Rafael Monnerat
May 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.recipes.random: Add Integer recipe.
parent
40f3b64c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
setup.py
setup.py
+1
-0
slapos/recipe/random.py
slapos/recipe/random.py
+22
-0
No files found.
setup.py
View file @
953f77dd
...
...
@@ -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'
,
...
...
slapos/recipe/random.py
View file @
953f77dd
...
...
@@ -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"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment